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

            Bug ID: 61641
           Summary: [4.9 Regression] undefined label in jump_table_data
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: danglin at gcc dot gnu.org
              Host: hppa-unknown-linux-gnu
            Target: hppa-unknown-linux-gnu
             Build: hppa-unknown-linux-gnu

Created attachment 33027
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33027&action=edit
Preprocessed source

dave@mx3210:~/mesa-gcc$ g++ -fpreprocessed -fvisibility=hidden -g -O2 -Wformat
-Werror=format-security -Wall -Wall -fno-strict-aliasing -fno-builtin-memcmp
-MT opt_vectorize.lo -MD -MP -MF .deps/opt_vectorize.Tpo -c opt_vectorize.ii 
-fPIC -DPIC -o opt_vectorize.o
/tmp/ccGEh3f3.s: Assembler messages:
/tmp/ccGEh3f3.s:717: Error: can't resolve `.L71' {.text section} - `.L78'
{*UND* section}
/tmp/ccGEh3f3.s:718: Error: can't resolve `.L79' {.text section} - `.L78'
{*UND* section}
/tmp/ccGEh3f3.s:719: Error: can't resolve `.L72' {.text section} - `.L78'
{*UND* section}
/tmp/ccGEh3f3.s:720: Error: can't resolve `.L82' {.text section} - `.L78'
{*UND* section}
/tmp/ccGEh3f3.s:721: Error: can't resolve `.L72' {.text section} - `.L78'
{*UND* section}
/tmp/ccGEh3f3.s:722: Error: can't resolve `.L72' {.text section} - `.L78'
{*UND* section}
/tmp/ccGEh3f3.s:723: Error: can't resolve `.L72' {.text section} - `.L78'
{*UND* section}
/tmp/ccGEh3f3.s:724: Error: can't resolve `.L70' {.text section} - `.L78'
{*UND* section}

We have following RTL after barriers pass:

(jump_insn:TI 135 164 136 (parallel [
            (set (pc)
                (mem:SI (plus:SI (mult:SI (reg:SI 20 %r20 [orig:141 D.35077 ]
[141])
                            (const_int 4 [0x4]))
                        (label_ref 136)) [0  S4 A32]))
            (clobber (reg:SI 21 %r21))
            (clobber (reg:SI 22 %r22))
        ]) ../../../../src/glsl/opt_vectorize.cpp:224 193 {casesi32p}
     (expr_list:REG_DEAD (reg:SI 20 %r20 [orig:141 D.35077 ] [141])
        (expr_list:REG_UNUSED (reg:SI 22 %r22)
            (expr_list:REG_UNUSED (reg:SI 21 %r21)
                (nil))))
 -> 136)
(code_label 136 135 295 78 "" [1 uses])
(insn 295 136 137 (const_int 1 [0x1]) -1
     (nil))
(jump_table_data 137 295 296 (addr_diff_vec:SI (label_ref:SI 136)
         [
            (label_ref:SI 62)
            (label_ref:SI 139)
            (label_ref:SI 57)
            (label_ref:SI 163)
            (label_ref:SI 57)
            (label_ref:SI 57)
            (label_ref:SI 57)
            (label_ref:SI 53)
        ]
        (const_int 0 [0])
        (const_int 0 [0])))
(insn 296 137 138 (const_int 2 [0x2]) -1
     (nil))
(barrier 138 296 53)

After dbr pass, we have:

(barrier 59 57 58)
(note 58 59 164 [bb 11] NOTE_INSN_BASIC_BLOCK)
(note 164 58 137 [bb 12] NOTE_INSN_BASIC_BLOCK)
(jump_table_data 137 164 296 (addr_diff_vec:SI (label_ref:SI 136)
         [
            (label_ref:SI 62)
            (label_ref:SI 139)
            (label_ref:SI 57)
            (label_ref:SI 163)
            (label_ref:SI 57)
            (label_ref:SI 57)
            (label_ref:SI 57)
            (label_ref:SI 53)
        ]
        (const_int 0 [0])
        (const_int 0 [0])))
(insn 296 137 138 (const_int 2 [0x2]) 211 {end_brtab}
     (nil))
(barrier 138 296 53)

The casesi jump and code_label 136 have been deleted, but not the
addr_diff_vec using code_label 136.

This results in the incorrect assembly code.

Reply via email to