Bug 106418 - '-fcompare-debug' failure w/ -mcpu=e500mc -O2 -fnon-call-exceptions -fsched-stalled-insns -fno-reorder-blocks -fno-thread-jumps -fno-tree-dce
Summary: '-fcompare-debug' failure w/ -mcpu=e500mc -O2 -fnon-call-exceptions -fsched-s...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 13.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: compare-debug-failure
Depends on:
Blocks:
 
Reported: 2022-07-23 06:55 UTC by Arseny Solokha
Modified: 2022-11-22 10:21 UTC (History)
2 users (show)

See Also:
Host:
Target: powerpc-*-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Arseny Solokha 2022-07-23 06:55:13 UTC
gcc 13.0.0 20220717 snapshot (g:7bcd7f47359b903bf7a193b95d4450d9d69c60ba) fails -fcompare-debug check when compiling the following testcase w/ -mcpu=e500mc -O2 -fcompare-debug -fnon-call-exceptions -fsched-stalled-insns -fno-reorder-blocks -fno-thread-jumps -fno-tree-dce:

int n;

__attribute__ ((noinline)) int
return_zero (void)
{
  return 0;
}

__attribute__ ((noinline)) int
return_one (void)
{
  return 1;
}

__attribute__ ((noinline)) void
empty (int)
{
}

int
foo (int x)
{
  if (x)
    empty (n);
  else if (return_zero () == n)
    empty (return_one ());

  return 0;
}

% powerpc-e300c3-linux-gnu-gcc-13.0.0 -mcpu=e500mc -O2 -fcompare-debug -fnon-call-exceptions -fsched-stalled-insns -fno-reorder-blocks -fno-thread-jumps -fno-tree-dce -c vjbxa62g.c
powerpc-e300c3-linux-gnu-gcc-13.0.0: error: vjbxa62g.c: '-fcompare-debug' failure

gkd diff:

--- vjbxa62g.c.gkd      2022-07-23 13:54:24.325382258 +0700
+++ vjbxa62g.gk.c.gkd   2022-07-23 13:54:24.350381830 +0700
@@ -188,22 +188,17 @@
 (insn:TI # 0 0 (set (reg/i:SI 3 3)
         (const_int 0 [0])) "vjbxa62g.c":29:1# {*movsi_internal1}
      (nil))
-(insn # 0 0 (unspec_volatile [
+(insn:TI # 0 0 (unspec_volatile [
             (const_int 0 [0])
         ] UNSPECV_BLOCK) "vjbxa62g.c":29:1# {blockage}
      (nil))
+(insn # 0 0 (use (reg/i:SI 3 3)) "vjbxa62g.c":29:1#
+     (nil))
 (note # 0 0 NOTE_INSN_EPILOGUE_BEG)
-(insn:TI # 0 0 (set (reg:SI 0 0)
+(insn # 0 0 (set (reg:SI 0 0)
         (mem/c:SI (plus:SI (reg/f:SI 1 1)
                 (const_int 36 [0x24])) [  S4 A8])) "vjbxa62g.c":29:1# {*movsi_internal1}
      (nil))
-(insn # 0 0 (use (reg/i:SI 3 3)) "vjbxa62g.c":29:1#
-     (nil))
-(insn/f # 0 0 (set (reg:SI 96 lr)
-        (reg:SI 0 0)) "vjbxa62g.c":29:1# {*movsi_internal1}
-     (expr_list:REG_DEAD (reg:SI 0 0)
-        (expr_list:REG_CFA_RESTORE (reg:SI 96 lr)
-            (nil))))
 (insn:TI # 0 0 (set (reg:SI 31 31)
         (mem/c:SI (plus:SI (reg/f:SI 1 1)
                 (const_int 28 [0x1c])) [  S4 A8])) "vjbxa62g.c":29:1# {*movsi_internal1}
@@ -218,7 +213,12 @@
      (expr_list:REG_CFA_DEF_CFA (reg/f:SI 1 1)
         (expr_list:REG_CFA_RESTORE (reg:SI 31 31)
             (nil))))
-(jump_insn:TI # 0 0 (simple_return) "vjbxa62g.c":29:1# {simple_return}
+(insn/f:TI # 0 0 (set (reg:SI 96 lr)
+        (reg:SI 0 0)) "vjbxa62g.c":29:1# {*movsi_internal1}
+     (expr_list:REG_DEAD (reg:SI 0 0)
+        (expr_list:REG_CFA_RESTORE (reg:SI 96 lr)
+            (nil))))
+(jump_insn # 0 0 (simple_return) "vjbxa62g.c":29:1# {simple_return}
      (nil)
  -> simple_return)
 (barrier # 0 0)
Comment 1 Peter Bergner 2022-08-24 03:33:32 UTC
Surya, might this be related to the sched1 -fcompare-debug issue you have a patch for?  Or is this something new?
Comment 2 Surya Kumari Jangala 2022-11-22 10:21:45 UTC
The issue reported here is the same as in bug 105586
The test provided in the description passes with the patch that fixes bug 105586, and fails w/o the patch.
Hence closing this bug.