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

            Bug ID: 104459
           Summary: [9/10/11/12 Regression] '-fcompare-debug' failure w/
                    -O2 -funswitch-loops -fno-tree-dce
           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 20220206 snapshot (g:8eb329e963593342855b6072e5692659107337b7) fails
-fcompare-debug check when compiling the following testcase w/ -O2
-funswitch-loops -fno-tree-dce:

void
foo (int x, int y)
{
  unsigned int a;

  for (;;)
    {
      short int *p = (short int *) &x;
      unsigned int q = 0;

      a /= 2;
      if (a)
        {
          q -= y;
          while (q)
            {
            }
        }

      if (x)
        {
          for (q = 0; q != 1; q += 2)
            {
              unsigned int n;

              n = *p ? 0 : q;
              y += n < 1;

              n = a || *p;
              if (n % x == 0)
                y /= x;
            }
        }

    }
}

% gcc-12.0.1 -O2 -fcompare-debug -funswitch-loops -fno-tree-dce -c rfygrmu3.c
gcc-12.0.1: error: rfygrmu3.c: '-fcompare-debug' failure

--- rfygrmu3.c.gkd      2022-02-09 18:38:41.086339468 +0700
+++ rfygrmu3.gk.c.gkd   2022-02-09 18:38:41.117339440 +0700
@@ -32,7 +32,7 @@
             (pc))) "rfygrmu3.c":20:10# {*jcc}
      (expr_list:REG_DEAD (reg:CCZ 17 flags)
         (int_list:REG_BR_PROB 118111604 (nil)))
- -> 18)
+ -> 19)
 (code_label # 0 0 4 4 (nil) [1 uses])
 (note # 0 0 [bb 4] NOTE_INSN_BASIC_BLOCK)
 (insn:TI # 0 0 4 (set (reg/v:SI 36 r8 [orig:89 a ] [89])
@@ -79,7 +79,7 @@
      (nil)
  -> 3)
 (barrier # 0 0)
-(code_label # 0 0 7 18 (nil) [1 uses])
+(code_label # 0 0 7 19 (nil) [1 uses])
 (note # 0 0 [bb 7] NOTE_INSN_BASIC_BLOCK)
 (insn:TI # 0 0 7 (set (reg:CCZ 17 flags)
         (compare:CCZ (reg:HI 5 di [orig:94 x ] [94])

Reply via email to