This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug web/70127] New: wrong code on x86_64-linux-gnu at -O3 in 32-bit and 64-bit modes
- From: "chengniansun at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 07 Mar 2016 19:06:15 +0000
- Subject: [Bug web/70127] New: wrong code on x86_64-linux-gnu at -O3 in 32-bit and 64-bit modes
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70127
Bug ID: 70127
Summary: wrong code on x86_64-linux-gnu at -O3 in 32-bit and
64-bit modes
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: web
Assignee: unassigned at gcc dot gnu.org
Reporter: chengniansun at gmail dot com
Target Milestone: ---
The following code is miscompiled by the trunk, gcc-4.7 and gcc-4.8 at -O3 in
both 32-bit and 64-bit modes on x86_64-linux-gnu.
$: 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 20160307 (experimental) [trunk revision 234022] (GCC)
$:
$: gcc-trunk -O3 small.c ; ./a.out
0
$: gcc-4.7 -O3 small.c ; ./a.out
0
$: gcc-4.8 -O3 small.c ; ./a.out
0
$: gcc-trunk -O0 small.c ; ./a.out
1
$: cat small.c
int printf(const char *, ...);
struct S0 {
int f0;
signed f1 : 2;
} a[1], c = {5, 1}, d;
short b;
int main() {
for (; b <= 0; b++) {
struct S0 e = {1, 1};
d = e = a[0] = c;
}
printf("%d\n", a[0].f1);
return 0;
}
$: