https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104263
Bug ID: 104263 Summary: [10/11/12 Regression] '-fcompare-debug' failure (length) w/ -O2 -fnon-call-exceptions -fno-inline-small-functions Product: gcc Version: 12.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: --- gcc 12.0.1 20220123 snapshot (g:2da90ad39bf8fa9ee287e040d1f4411cb7a2e7ed) fails -fcompare-debug check when compiling the following testcase w/ -O2 -fnon-call-exceptions -fno-inline-small-functions: int n; int bar (void) { int a; n = 0; a = 0; return n; } __attribute__ ((pure, returns_twice)) int foo (void) { n = bar () + 1; foo (); return 0; } % gcc-12.0.1 -O2 -fcompare-debug -fnon-call-exceptions -fno-inline-small-functions -gno-statement-frontiers -c ovslsrlb.c x86_64-pc-linux-gnu-gcc-12.0.1: error: ovslsrlb.c: '-fcompare-debug' failure (length) For x86_64 the difference looks like this, though the failure is not target-specific: --- ovslsrlb.c.gkd 2022-01-28 09:42:43.969435346 +0700 +++ ovslsrlb.gk.c.gkd 2022-01-28 09:42:43.987435394 +0700 @@ -40,8 +40,8 @@ (note # 0 0 [bb 2] NOTE_INSN_BASIC_BLOCK) (note # 0 0 NOTE_INSN_PROLOGUE_END) (note # 0 0 NOTE_INSN_FUNCTION_BEG) -(insn:TI # 0 0 2 (set (mem/c:SI (symbol_ref:DI ("n") [flags 0x2] <var_decl # n>) [ MEM[(int *)&n]+0 S4 A32]) - (const_int 1 [0x1])) "ovslsrlb.c":8:5# {*movsi_internal} +(insn:TI # 0 0 2 (set (mem/c:SI (symbol_ref:DI ("n") [flags 0x2] <var_decl # n>) [ n+0 S4 A32]) + (const_int 1 [0x1])) "ovslsrlb.c":17:5# {*movsi_internal} (nil)) (insn # 0 0 2 (parallel [ (set (reg:DI 0 ax)