This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/79666] New: wrong code (SIGFPE) at -O2 on x86_64-linux-gnu (in both 32-bit and 64-bit modes)
- From: "su at cs dot ucdavis.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 21 Feb 2017 23:03:23 +0000
- Subject: [Bug tree-optimization/79666] New: wrong code (SIGFPE) at -O2 on x86_64-linux-gnu (in both 32-bit and 64-bit modes)
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79666
Bug ID: 79666
Summary: wrong code (SIGFPE) at -O2 on x86_64-linux-gnu (in
both 32-bit and 64-bit modes)
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: su at cs dot ucdavis.edu
Target Milestone: ---
It seems to be a very recent regression.
$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.1 20170221 (experimental) [trunk revision 245619] (GCC)
$
$ gcc-trunk -Os small.c; ./a.out
$ gcc-6.2 -O2 small.c; ./a.out
$
$ gcc-trunk -O2 small.c
$ ./a.out
Floating point exception (core dumped)
$
---------------------------------------------------------
struct
{
unsigned a:6;
} b;
int c, e, g = 7;
char d, f = 6, h = -10;
void fn1 ()
{
for (; c < 9; c++)
{
if (f)
g = ~(~0 / (g ^ e));
b.a = ~0;
d = ~((h ^ b.a) & 132 & (~(f && g) | (d && 1)));
e = ~0;
if (d < 127 || f < 1)
continue;
g = 0;
}
}
int main ()
{
fn1 ();
return 0;
}