g++ otimizes out const globals
Mike Stump
mrs@wrs.com
Mon Mar 15 16:20:00 GMT 1999
> To: egcs-bugs@egcs.cygnus.com
> Date: Mon, 15 Mar 1999 11:11:07 -0800
> From: John Milford <jwm@CSUA.Berkeley.EDU>
> A simple test case would be one line :
> echo const int foo = 10; > test.c
> gcc -O3 -S test.c produces:
> .file "test.c"
> gcc2_compiled.:
> ___gnu_compiled_c:
> .globl _name1
> .text
> .align 2,0x90
> .type _name1,@object
> .size _name1,4
> _name1:
> .long 1
> g++ -O -S test.c produces:
> .file "test.c"
> gcc2_compiled.:
> ___gnu_compiled_cplusplus:
> I have not been able to find anything in C++ that would
> justify this, but my Stroustroup is fairly old.
Not a bug. If you want to report that gdb doesn't know what value foo
has, that is fine, and it would be nice to pass the value of
`constants' like this to gdb, but if you do, you should be more
explicit about it. Off hand, I can't guess why you thought this was a
bug.
More information about the Gcc-bugs
mailing list