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

            Bug ID: 85582
           Summary: wrong code at -O1 and above on x86_64-linux-gnu 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 20180501 (experimental) [trunk revision 259787] (GCC) 
$ 
$ gcctk -m32 -O0 small.c; ./a.out
$ 
$ gcctk -m32 -O1 small.c
$ ./a.out
Floating point exception (core dumped)
$ 

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

int a, b, d = 2, e; 
long long c = 1;

int main ()
{
  int g = 6;
 L1:
  e = d;
  if (a)
    goto L1;
  g--;
  int i = c >> ~(~e | ~g);
 L2:
  c = (b % c) * i;
  if (!e)
    goto L2;
  return 0;
}

Reply via email to