This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/80900] New: wrong code at -O2 and -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu
- From: "chengniansun at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 28 May 2017 05:14:11 +0000
- Subject: [Bug c/80900] New: wrong code at -O2 and -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80900
Bug ID: 80900
Summary: wrong code at -O2 and -O3 in both 32-bit and 64-bit
modes on x86_64-linux-gnu
Product: gcc
Version: unknown
Status: RESOLVED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: chengniansun at gmail dot com
CC: chengniansun at gmail dot com
Target Milestone: ---
Status: RESOLVED
CC: chengniansun at gmail dot com
Resolution: DUPLICATE
$ 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/8.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 8.0.0 20170527 (experimental) [trunk revision 248540] (GCC)
$
$ gcc-trunk -m32 -O3 small.c ; ./a.out
0
$ gcc-trunk -m32 -Os small.c ; ./a.out
3
$ cat small.c
int printf(const char *, ...);
struct S0 {
int f0 : 24;
int f1;
int f74;
} a, *c = &a;
struct S0 fn1() {
struct S0 b = {4, 3};
return b;
}
int main() {
*c = fn1();
printf("%d\n", a.f1);
return 0;
}
$
--- Comment #1 from Chengnian Sun <chengniansun at gmail dot com> ---
Reported twice due to gateway timeout.
*** This bug has been marked as a duplicate of bug 80898 ***