[Bug debug/44832] [4.6 Regression] -fcompare-debug failure for C++ i386.c

amylaar at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Jul 7 19:53:00 GMT 2010



------- Comment #32 from amylaar at gcc dot gnu dot org  2010-07-07 19:53 -------
tree-vrp.c:find_switch_asserts uses compare_case_labels to sort case labels,
with the main key being the uid of the case label.
We have different case labels when debugging, and their uid sorts differently
in relation to user labels that happen to become case labels.

With debug enabled, the label 'half' is sorted at the start of the array:

(gdb) call debug_tree($49[0])
 <case_label_expr 0xb7dab0b4
    type <void_type 0xb7d00840 void asm_written VOID
        align 8 symtab 0 alias set -1 canonical type 0xb7d00840
        pointer_to_this <pointer_type 0xb7d008a0>>
    side-effects tree_1
    arg 0 <integer_cst 0xb7d18300 type <integer_type 0xb7d002a0 int> constant
5>
    arg 2 <label_decl 0xb7d99bd0 half type <void_type 0xb7d00840 void>
        VOID file t.c line 75 col 1
        align 1 context <function_decl 0xb7d88980 ix86_expand_vector_init>
initial <error_mark 0xb7cf07e0> abstract_origin <label_decl 0xb7cf9f18 half>>
    t.c:73:5>
(gdb) call debug_tree((tree)0xb7d99bd0)
 <label_decl 0xb7d99bd0 half
    type <void_type 0xb7d00840 void asm_written VOID
        align 8 symtab 0 alias set -1 canonical type 0xb7d00840
        pointer_to_this <pointer_type 0xb7d008a0>>
    VOID file t.c line 75 col 1
    align 1 context <function_decl 0xb7d88980 ix86_expand_vector_init> initial
<error_mark 0xb7cf07e0> abstract_origin <label_decl 0xb7cf9f18 half>>
(gdb) p ((tree)0xb7d99bd0)->decl_minimal.uid
$50 = 1877
(gdb) call debug_tree($49[1])
 <case_label_expr 0xb7dab024
    type <void_type 0xb7d00840 void asm_written VOID
        align 8 symtab 0 alias set -1 canonical type 0xb7d00840
        pointer_to_this <pointer_type 0xb7d008a0>>
    side-effects tree_1
    arg 2 <label_decl 0xb7d99c24 L.xxxx type <void_type 0xb7d00840 void>
        used ignored VOID file t.c line 95 col 5
        align 1 context <function_decl 0xb7d88980 ix86_expand_vector_init>
abstract_origin <label_decl 0xb7d93000 L.xxxx>>
    t.c:95:5>
(gdb) p ((tree)0xb7d99c24)->decl_minimal.uid
$51 = 1890


With debug disabled, 'half' sorts at the end of the array:

(gdb) call debug_tree($44[3])
 <case_label_expr 0xb7da4090
    type <void_type 0xb7d00840 void VOID
        align 8 symtab 0 alias set -1 canonical type 0xb7d00840
        pointer_to_this <pointer_type 0xb7d008a0>>
    side-effects tree_1
    arg 0 <integer_cst 0xb7d182a0 type <integer_type 0xb7d002a0 int> constant
3>
    arg 1 <integer_cst 0xb7d182d0 type <integer_type 0xb7d002a0 int> constant
4>
    arg 2 <label_decl 0xb7d98c24 L.27 type <void_type 0xb7d00840 void>
        used ignored VOID file t.c line 67 col 5
        align 1 context <function_decl 0xb7d88900 ix86_expand_vector_init>
abstract_origin <label_decl 0xb7cf9e1c L.0>>
    t.c:67:5>
(gdb) call debug_tree($44[4])
 <case_label_expr 0xb7da40b4
    type <void_type 0xb7d00840 void VOID
        align 8 symtab 0 alias set -1 canonical type 0xb7d00840
        pointer_to_this <pointer_type 0xb7d008a0>>
    side-effects tree_1
    arg 0 <integer_cst 0xb7d18300 type <integer_type 0xb7d002a0 int> constant
5>
    arg 2 <label_decl 0xb7d98c78 half type <void_type 0xb7d00840 void>
        used VOID file t.c line 75 col 1
        align 1 context <function_decl 0xb7d88900 ix86_expand_vector_init>
initial <error_mark 0xb7cf07e0> abstract_origin <label_decl 0xb7cf9f18 half>>
    t.c:73:5>
(gdb) p ((tree)0xb7d98c24)->decl_minimal.uid
$46 = 1892
(gdb) p ((tree)0xb7d98c78)->decl_minimal.uid
$47 = 1893


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44832



More information about the Gcc-bugs mailing list