This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/35501] New: Wrong value returned from const int
- From: "hjl dot tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Mar 2008 19:21:19 -0000
- Subject: [Bug tree-optimization/35501] New: Wrong value returned from const int
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
[hjl@gnu-26 gcc]$ cat x.i
const int conststaticvariable = 3;
int f(void)
{
return conststaticvariable;
}
[hjl@gnu-26 gcc]$ ./xgcc -B./ -O2 x.i -S -fPIC -m32
[hjl@gnu-26 gcc]$ cat x.s
.file "x.i"
.text
.p2align 4,,15
.globl f
.type f, @function
f:
pushl %ebp
movl $3, %eax
movl %esp, %ebp
popl %ebp
ret
We can't return 3 when PIC is used since conststaticvariable may
be resolved to another definition at run-time.
--
Summary: Wrong value returned from const int
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hjl dot tools at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35501