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

--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
One of several testsuite failures (with non-bootstrapped compiler) is:

FAIL: gcc.c-torture/execute/20020805-1.c   -Os  execution test

--cut here--
extern void abort (void);
extern void exit (int);

void check (unsigned int m)
{
  if (m != (unsigned int) -1)
    abort ();
}

unsigned int n = 1;

int main (void)
{
  unsigned int m;
  m = (1 | (2 - n)) | (-n);
  check (m);
  exit (0);
}
--cut here--

So, the difference between trunk (+) and trunk with reverted patch (-) starts
at _.214r.combine, where "check" function gets miscompiled:

     4: NOTE_INSN_BASIC_BLOCK 2
     2: NOTE_INSN_DELETED
     3: NOTE_INSN_FUNCTION_BEG
-    6: r71:DI=zero_extend($16:SI)
-      REG_DEAD $16:DI
+    6: NOTE_INSN_DELETED
     7: r73:DI=0xffffffffffffffff
     8: r72:DI=r73:DI 0>>0x20
       REG_DEAD r73:DI
       REG_EQUAL 0xffffffff
-    9: r74:DI=r71:DI==r72:DI
+    9: r74:DI=$16:DI==r72:DI
+      REG_DEAD $16:DI
       REG_DEAD r72:DI
-      REG_DEAD r71:DI
    10: pc={(r74:DI!=0)?L16:pc}
       REG_DEAD r74:DI
       REG_BR_PROB 9996

This results in an asm code difference, where needed SI->DI zero_extend is
missing:

@@ -18,7 +18,6 @@
        lda $1,-1($31)
        lda $30,-16($30)
        .cfi_def_cfa_offset 16
-       zapnot $16,15,$16
        srl $1,32,$1
        stq $26,0($30)
        .cfi_offset 26, -16

I propose to revert H.J.'s patch for PR64037.

Reply via email to