This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/82363] New: wrong code at -O1, -O2 and -O3 on x86_64-linux-gnu
- 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: Fri, 29 Sep 2017 17:44:49 +0000
- Subject: [Bug tree-optimization/82363] New: wrong code at -O1, -O2 and -O3 on x86_64-linux-gnu
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82363
Bug ID: 82363
Summary: wrong code at -O1, -O2 and -O3 on x86_64-linux-gnu
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: ---
This seems to be a recent regression.
$ gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/home/su/software/tmp/gcc/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=/home/su/software/tmp/gcc/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 8.0.0 20170929 (experimental) [trunk revision 253283] (GCC)
$
$ gcc-7.2.0 -O1 small.c; ./a.out
1
$ gcctk -O0 small.c; ./a.out
1
$
$ gcctk -O1 small.c; ./a.out
0
$
-----------------------------------------
int printf (const char *, ...);
struct A
{
int b;
int c;
int d;
};
struct E
{
int f;
int g:18;
struct A h;
};
struct I
{
int b;
int j;
struct E k;
};
int l, *m = &l;
struct A n;
struct I o;
int main ()
{
while (1)
{
struct I q = { 0, 0, {0, 0, {1, 1, 1}}}, p = q, r = p, *s = &q;
if (p.k.h.c)
o = p;
*m = r.k.h.d;
n = (*s).k.h;
break;
}
printf ("%d\n", l);
return 0;
}