[Bug ipa/60120] wrong code (for code with the optimize attribute) at -Os on x86_64-linux-gnu in 32-bit mode
su at cs dot ucdavis.edu
gcc-bugzilla@gcc.gnu.org
Sat Feb 8 22:55:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60120
--- Comment #1 from Zhendong Su <su at cs dot ucdavis.edu> ---
Below is another testcase that very likely points to the same root cause, so I
also include it here. Hope it's useful to help diagnose the issue.
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/su/software/local/gcc-4.8/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.8.3/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.8/configure --enable-languages=c,c++
Thread model: posix
gcc version 4.8.3 20140208 (prerelease) [gcc-4_8-branch revision 207632] (GCC)
$
$ gcc -m32 -O1 small.c; a.out
$ gcc -m64 -Os small.c; a.out
$
$ gcc -m32 -Os small.c
$ timeout -s 9 10 a.out
Killed
$
$ gcc-4.7.3 -m32 -Os small.c; a.out
$ gcc-trunk -m32 -Os small.c; a.out
$
----------------------------
int a = 1;
static int
fn1 (int p1, short p2)
{
return p2 == 0 ? 0 : p1 / p2;
}
int
fn2 (int p)
{
return 0 ? 0 : p;
}
__attribute__ ((optimize (0)))
int fn3 ()
{
if (fn1 (fn2 (72260), a))
;
else
for (;;)
;
return 0;
}
int
main ()
{
fn3 ();
return 0;
}
More information about the Gcc-bugs
mailing list