This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/69811] New: A gcc folding issue at -O0
- From: "helloqirun at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 14 Feb 2016 04:25:30 +0000
- Subject: [Bug tree-optimization/69811] New: A gcc folding issue at -O0
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69811
Bug ID: 69811
Summary: A gcc folding issue at -O0
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: helloqirun at gmail dot com
Target Milestone: ---
Starting from 5.1, the gcc-trunk at -O0 does not perform constant folding for
the following example.
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20160213 (experimental) [trunk revision 233402] (GCC)
$ cat abc.c
extern void aabb (void);
int main ()
{
if (0 == "a"+1)
aabb ();
return 0;
}
$ gcc-4.9 -O0 abc.c
$ gcc-trunk -O0 abc.c
/tmp/cc00w34u.o: In function `main':
abc.c:(.text+0xf): undefined reference to `aabb'
collect2: error: ld returned 1 exit status
As a result, the current gcc-trunk may emit a call to function aabb().
$ cat abc.c
void aabb (void){}
int main ()
{
if (0== "a" +1)
aabb ();
return 0;
}
$ gcc-4.9 -O0 abc.c
$ objdump -d a.out | grep aabb
00000000004004f6 <aabb>:
And for trunk version:
$ gcc-trunk -O0 abc.c
$ objdump -d a.out | grep aabb
0000000000400496 <aabb>:
4004ab: e8 e6 ff ff ff callq 400496 <aabb>