This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Optimizer Bug
- To: rmf at bcandid dot com
- Subject: Re: Optimizer Bug
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Fri, 3 Mar 2000 22:09:43 +0100
- CC: gcc-bugs at gcc dot gnu dot org
- References: <200003031719.MAA27464@magic.highwind.com>
> Turning on optimization causes a warning. I'm very worried that this
> causes INCORRECT code to be generated by the latest gcc.
Thanks for your bug report. I think you don't worry; g++ is confused
to emit this warning. It generates the following code (on
i586-pc-linux-gnu):
foo__Fv:
.LFB1:
.LEHB15:
pushl %ebp
.LCFI0:
movl %esp,%ebp
.LCFI1:
subl $24,%esp
.LCFI2:
addl $-12,%esp
pushl $4
.LCFI3:
call __builtin_new
movl $3,(%eax)
jmp .L58
.LEHE15:
.p2align 4,,7
.L16:
.LCFI4:
call __throw
.p2align 4,,7
.L15:
jmp .L16
.p2align 4,,7
.L58:
movl %ebp,%esp
popl %ebp
ret
Here, you can see that, after returning from __builtin_new, it puts a
3 into the new memory, and jumps to L58, at which point it still has
the result of the new in eax, so that gets returned from the function.
I don't fully understand why the warning is emitted; I've put it your
report into GNATS.
Martin