This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/80898] New: wrong code at -O2 and -O3 in both 32-bit and 64-bit modes on x86_64-linux-gnu


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80898

            Bug ID: 80898
           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: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com
  Target Milestone: ---

$ 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> ---
*** Bug 80900 has been marked as a duplicate of this bug. ***

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]