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

            Bug ID: 85767
           Summary: wrong code at -O2 and -O3 on x86_64-linux-gnu in
                    64-bit mode (not in 32-bit mode)
           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: ---

$ 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/9.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 9.0.0 20180512 (experimental) [trunk revision 260198] (GCC)
$
$ gcctk -m64 -Os small.c; ./a.out
$ gcctk -m32 -O2 small.c; ./a.out
$
$ gcctk -m64 -O2 small.c
$ ./a.out
Floating point exception (core dumped)
$


----------------------------------------------


short a, h, j;
unsigned char b = 0xFF;
unsigned c = 1;
int d, f, g = -2, l, m = -1;
char e;
long k;

void fn1 ()
{ 
  int i = 0;
  for (; i < 1; i++)
    { 
      int o = ~(h & 1000);
      short p = o ^ ~b;
      char q = o % (h ^ b);
      if (p)
        { 
          j = h;
        L1:
          h = f % (~a % b) ^ q;
          b = (j >> e) % q;
        }
      int s = l || d;
      if (c)
        { 
          l = ~((b ^ g) + (~m ^ s ^ k));
          c = ~0 / g << d;
          d = 0;
          if (l < 0)
            goto L1;
        }
    L2:
      m++;
    }
  if (m)
    goto L2;
}

int main ()
{ 
  fn1 ();
  return 0;
}

Reply via email to