[Bug c++/90354] New: [7.3 regression] Skip the not first insn when traversing the insn node

zhongyunde at huawei dot com gcc-bugzilla@gcc.gnu.org
Sun May 5 10:23:00 GMT 2019


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

            Bug ID: 90354
           Summary: [7.3 regression] Skip the not first insn when
                    traversing the insn node
           Product: gcc
           Version: 7.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhongyunde at huawei dot com
  Target Milestone: ---

simplified testcase base on g++.eh/ia64-1.C:
~/ICE » cat exp1.C                                                             
                                                                               
                                                        zhongyunde@linux-125

#include <exception>

using namespace std;

extern "C" void abort();
extern "C" void bar(long a0, long a1, long a2, long a3, long a4);
extern "C" void foo(long a0);

int l_0, l_1, l_2;

#define A(x,y,n) register int *x##n = &y##_##n;
#define C(x,n) asm volatile ("" : "=r" (x##n) : "0" (x##n));
#define E(x,y,n) if (x##n != &y##_##n) abort ();


void foo(long a0)
{
  A(p,l,0) A(p,l,1) A(p,l,2)
  C(p,0) C(p,1) C(p,2)
  bar (0, 1, 2, 3, 4);
  if (a0 == 0)
    throw exception();
  C(p,0) C(p,1) C(p,2)
  E(p,l,0) E(p,l,1) E(p,l,2)
}


in function scan_trace of GCC source, we use NEXT_INSN (insn) to traversing all
the insn nodes

  for (prev = insn, insn = NEXT_INSN (insn);
       insn;
       prev = insn, insn = NEXT_INSN (insn))
    {
      rtx_insn *control;

      ...
    }

while in .nothrow dump, the jump_insn may in sequence but not the first insn of
the sequence , so we'll omit it and don't generate CFI label ?

(insn 121 120 51 (sequence [
            (insn:TI 45 120 74 3 (set (reg:CC 158 tb)
                    (eq:CC (reg:SI 24 a24 [orig:180 p0 ] [180])
                        (reg:SI 12 a12))) exp1.C:25 960 {tsteq}
                 (expr_list:REG_CYCLE (const_int 24 [0x18])
                    (expr_list:REG_DEAD (reg:SI 24 a24 [orig:180 p0 ] [180])
                        (expr_list:REG_DEAD (reg:SI 12 a12)
                            (nil)))))
            (insn 74 45 46 3 (set (reg:SI 1 a1)
                    (plus:SI (reg:SI 0 a0)
                        (const_int 4 [0x4]))) exp1.C:25 4 {addsi3}
                 (expr_list:REG_CYCLE (const_int 24 [0x18])
                    (expr_list:REG_DEAD (reg:SI 0 a0)
                        (nil))))
            (jump_insn 46 74 51 3 (set (pc)
                    (if_then_else (eq (reg:CC 158 tb)
                            (const_int 0 [0]))
                        (label_ref:SI 52)
                        (pc))) exp1.C:25 57 {cbranchcc4}
                 (expr_list:REG_CYCLE (const_int 24 [0x18])
                    (expr_list:REG_INTRA_COF (nil)
                        (expr_list:REG_DEAD (reg:CC 158 tb)
                            (expr_list:REG_BR_PROB (const_int 4 [0x4])
                                (nil)))))
             -> 52)
        ]) exp1.C:25 -1
     (nil))


here is the final assemble, it lacks an CFI lable.
.LVLWLABEL8:{
        tsteq@ags       a24, a12
        addi@ags        a1, a0, 4
        bf@pcu          .L4, 1   ## Not the first insn in sequence
        }

...
        retrr@pcu
    ########  expect an LCFIx: here !! 
.L4:
        call0@pcu       abort, 0


More information about the Gcc-bugs mailing list