Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 930311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:18:48+00:00 2026-05-15T20:18:48+00:00

Is it common for compilers (gcc for instance) to generate an instruction that loads

  • 0

Is it common for compilers (gcc for instance) to generate an instruction that loads some empty memory element into a register? Like… lw at,0(sp) where memory[sp + 0] = 0. This basically just places 0 into $at ($R1.) I ask because I’m looking through an executable file’s hex dump (executable file is the result of the compilation of a c++ file) and I’m manually verifying it and if I start at the objdump state entry point I run into an instruction that does this. I’m not sure whether I should take this to be an error if it’s just a common compiler action. It seems like a poor way to zero a register. ADDU $at,$0,$0 would be better. Or SLL $at,$0,$0..

The entry point is 400890. The jump target of the jal at the end is an empty memory location (tells me something is probably wrong…) Note that my previous example was purposefully arbitrated.

And just to be clear, -32636+gp is an empty memory location. I can post the memory contents at the point if you’d like proof :).

00400890 <__start>:
  400890:   03e00021    move    zero,ra
  400894:   04110001    bal 40089c <__start+0xc>
  400898:   00000000    nop
  40089c:   3c1c0fc0    lui gp,0xfc0
  4008a0:   279c7864    addiu   gp,gp,30820
  4008a4:   039fe021    addu    gp,gp,ra
  4008a8:   0000f821    move    ra,zero
  4008ac:   8f848034    lw  a0,-32716(gp)
  4008b0:   8fa50000    lw  a1,0(sp)
  4008b4:   27a60004    addiu   a2,sp,4
  4008b8:   2401fff8    li  at,-8
  4008bc:   03a1e824    and sp,sp,at
  4008c0:   27bdffe0    addiu   sp,sp,-32
  4008c4:   8f878054    lw  a3,-32684(gp)
  4008c8:   8f888084    lw  t0,-32636(gp)<------ this instruction
  4008cc:   00000000    nop
  4008d0:   afa80010    sw  t0,16(sp)
  4008d4:   afa20014    sw  v0,20(sp)
  4008d8:   afbd0018    sw  sp,24(sp)
  4008dc:   8f998068    lw  t9,-32664(gp)
  4008e0:   00000000    nop
  4008e4:   0320f809    jalr    t9
  4008e8:   00000000    nop

Jal target is 4010c0.

4010c0: 8f998010    lw  t9,-32752(gp)
  4010c4:   03e07821    move    t7,ra
  4010c8:   0320f809    jalr    t9
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T20:18:48+00:00Added an answer on May 15, 2026 at 8:18 pm

    Perhaps it’s being placed after a jump statement? If so, that statement is run before the jump occurs and could be a do nothing instruction (nop). Beyond that, it could just be the compiler on a lower optimization setting. Another possibility is that the compiler is preserving the CPU flags field. Shift and Add play with flags while a load I don’t believe does.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 491k
  • Answers 491k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Selecting all descendants with class x of an element with… May 16, 2026 at 10:01 am
  • Editorial Team
    Editorial Team added an answer Somewhat a partial answer, but you can use the lagacy… May 16, 2026 at 10:01 am
  • Editorial Team
    Editorial Team added an answer It is possible to serve an HTML page with an… May 16, 2026 at 10:01 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

It's common for compilers to provide a switch to warn when code is unreachable
I am writing some C code which is expected to compile on multiple compilers
I've found some weird C++ preprocessor clauses, like: #define COMPILER_FLOAT_ENTRIES_DO(template) and #define COMPILER_FLOAT_ENTRIES_DO(template) \
As part of one of my projects, there are BeforeBuild tasks that ultimately generate
For instance: #include <stdio.h> void why_cant_we_switch_him(void *ptr) { switch (ptr) { case NULL: printf("NULL!\n");
For my own education I am curious what compilers use which C++ front-end and
I'm using a MinGW-based GCC cross-compiler to compile a project which uses SCons as
The JLS mentions in the type inference algorithm (§15.12.2): It is possible that the
Common LISP and Emacs LISP have the atom type predicate. Scheme and Clojure don't
A fairly common requirement in database applications is to track changes to one or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.