https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108656
Bug ID: 108656
Summary: [12/13 Regression] '-fcompare-debug' failure (length)
w/ -O2 -fno-ipa-pure-const -fno-tree-dce --param
early-inlining-insns=0
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: compare-debug-failure
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: asolokha at gmx dot com
Target Milestone: ---
g++ 13.0.0 20220515 snapshot (g:18547874ee205d830acb31f1e3c1c89fc7725c14) fails
-fcompare-debug check when compiling the following testcase w/ -O2
-fno-ipa-pure-const -fno-tree-dce --param early-inlining-insns=0:
volatile int q;
int m, n;
int
quux (int x)
{
return x;
}
int
corge (int x, int y)
{
if (x < 0 || x > y)
return 1;
return 0;
}
int
baz (void)
{
return m ? q : 0;
}
__attribute__ ((pure, returns_twice)) int
bar (void)
{
(void) baz ();
return 0;
}
int
foo (void)
{
int a = quux (0);
int b = corge (bar (), n);
return 0;
}
% gcc-13 -O2 -fcompare-debug -fno-ipa-pure-const -fno-tree-dce --param
early-inlining-insns=0 -c c46sgk3m.c
gcc-13: error: c46sgk3m.c: '-fcompare-debug' failure (length)
gkd diff:
(note # 0 0 NOTE_INSN_DELETED)
Declarations used by foo, sorted by DECL_UID:
-1: static volatile int q;
-0: static int m;
+2: static volatile int q;
+1: static int m;
+0: static int n;
;; Function foo (foo, funcdef_no=4, cgraph_uid=5, symbol_order=7)
@@ -184,17 +185,17 @@
(jump_insn # 0 0 2 (set (pc)
(if_then_else (eq (reg:CCZ 17 flags)
(const_int 0 [0]))
- (label_ref #)
+ (label_ref:DI #)
(pc))) "c46sgk3m.c":22:16# {*jcc}
(expr_list:REG_DEAD (reg:CCZ 17 flags)
(int_list:REG_BR_PROB 536870916 (nil)))
- -> 12)
+ -> 13)
(note # 0 0 [bb 3] NOTE_INSN_BASIC_BLOCK)
-(insn:TI # 0 0 3 (set (reg:SI 0 ax [orig:83 iftmp.0_10 ] [83])
+(insn:TI # 0 0 3 (set (reg:SI 0 ax [orig:84 iftmp.0_10 ] [84])
(mem/v/c:SI (symbol_ref:DI ("q") [flags 0x2] <var_decl # q>) [ q+0 S4
A32])) "c46sgk3m.c":22:16 discrim 1# {*movsi_internal}
- (expr_list:REG_UNUSED (reg:SI 0 ax [orig:83 iftmp.0_10 ] [83])
+ (expr_list:REG_UNUSED (reg:SI 0 ax [orig:84 iftmp.0_10 ] [84])
(nil)))
-(code_label # 0 0 4 12 (nil) [1 uses])
+(code_label # 0 0 4 13 (nil) [1 uses])
(note # 0 0 [bb 4] NOTE_INSN_BASIC_BLOCK)
(insn:TI # 0 0 4 (parallel [
(set (reg:DI 0 ax)