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 tree-optimization/69325] New: wrong code at -O3 on x86-64-linux-gnu (in 32- and 64-bit modes)


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

            Bug ID: 69325
           Summary: wrong code at -O3 on x86-64-linux-gnu (in 32- and
                    64-bit modes)
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com
  Target Milestone: ---

The following code is miscompiled by the gcc trunk at -O2 and -O3 in both
32-bit and 64-bit modes. 

$: 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-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20160116 (experimental) [trunk revision 232466] (GCC) 
$: 
$: gcc-trunk small.c -O3 -m32 ; ./a.out
$: gcc-trunk small.c -O3 -m64 ; ./a.out
$: gcc-trunk small.c -O2 -m32 ; ./a.out
$: gcc-trunk small.c -O2 -m64 ; ./a.out
$: gcc-trunk small.c -O0 -m64 ; ./a.out
g_302=4
$: cat small.c
int printf(const char*, ...);
int a, b, d, f;
char c;
static int *e = &d;
int main() {
  int g = -1L;
  *e = g;
  c = 4;
  for (; c >= 14; c++)
    *e = 1;
  f = a == 0;
  *e ^= f;
  int h = ~d;
  if (d)
    b = h;
  if (h)
    printf("g_302=%llu\n", (unsigned long long)c);
  return 0;
}
$:

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