Optimizer Bug
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Fri Mar 3 13:12:00 GMT 2000
> 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
More information about the Gcc-bugs
mailing list