[Bug rtl-optimization/70602] New: wrong code at -O1 and above on x86_64-linux-gnu in 32-bit mode (and at -Os only in 64-bit mode)
su at cs dot ucdavis.edu
gcc-bugzilla@gcc.gnu.org
Fri Apr 8 17:21:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70602
Bug ID: 70602
Summary: wrong code at -O1 and above on x86_64-linux-gnu in
32-bit mode (and at -Os only in 64-bit mode)
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: su at cs dot ucdavis.edu
Target Milestone: ---
The current gcc trunk miscompiles the following code on x86_64-linux-gnu at -O1
and above in the 32-bit mode and at -Os only in the 64-bit mode.
This is a regression from 5.3.x.
$ 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/6.0.0/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 6.0.0 20160408 (experimental) [trunk revision 234826] (GCC)
$
$ gcc-trunk -m32 -O0 small.c; ./a.out
$ gcc-5.3 -m32 -O1 small.c; ./a.out
$
$ gcc-trunk -m32 -O1 small.c
$ ./a.out
Segmentation fault (core dumped)
$
-----------------------------------------
#pragma pack(1)
struct S0
{
int f0:1;
int f1:20;
};
int a, b, c;
int
main ()
{
for (; a < 1; a++)
{
struct S0 e[] = { {0, 9}, {0, 9}, {0, 9}, {0, 0}, {0, 9}, {0, 9}, {0, 9},
{0, 0}, {0, 9}, {0, 9}, {0, 9}, {0, 0}, {0, 9}, {0, 9},
{0, 9}, {0, 0}, {0, 9}, {0, 9}, {0, 9}, {0, 0}, {0, 9}
};
b = b || e[0].f0;
c = e[0].f1;
}
return 0;
}
More information about the Gcc-bugs
mailing list