This is the mail archive of the
mailing list for the GCC project.
Re: Useless code generated by gcc 2.95.2????
- To: deweese at kodak dot com
- Subject: Re: Useless code generated by gcc 2.95.2????
- From: "Martin v. Loewis" <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Wed, 3 Nov 1999 08:44:01 +0100
- CC: gcc at gcc dot gnu dot org
- References: <firstname.lastname@example.org.HOWL>
> We are looking to upgrade from egcs 1.0.2 to gcc 2.95.2, and
> we noticed that object file sizes have gone up significantly (~50%)
> between the two releases (On Sparc). So, I thought I would take a
> look at some of the generated asm. I noticed what looked to be dead
> code that was generated. Based on my observations I have generated a
> small test case:
Thanks for your bug report. My (shallow) analysis agrees with yours;
it indeed appears that this is dead code. Notice how the code
following LL5 is similar to the one following LL3.
I have not tried to understand in detail why this code is emitted. It
could be either a duplication of exception handlers, or it could be
cover some case that does not appear in your example.
Please understand that I'm not terribly worried about this code. I
compiled your code with optimization (-O2); the assembler code
generated for that is attached. Long and obfuscated machine code in
non-optimizing mode is not strictly a bug - incorrect code would be a
bug. Also, dead code in optimizing mode could be a bug.
If you want to understand in detail why this code is generated, you
may try using the "-da" option. This dumps a number of internal
structures (RTL) into files. Those structures are later used to
generate assembler output.
Hope this helps,
save %sp, -112, %sp
mov 1, %o0
call __builtin_new, 0
sethi %hi(fu8), %l0
st %o0, [%l0+%lo(fu8)]