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

--- Comment #9 from Martin Liška <mliska at suse dot cz> ---
On 8/6/19 2:54 PM, glisse at gcc dot gnu.org wrote:
> Does the enum really have a precision of 5 bits? I would have expected
> (1<<5)-11 instead of 4294967285 (i.e. (1<<32)-11), without looking at it too
> closely.

Yep, if I see correctly:


(gdb) p debug_tree(*lhs)
 <ssa_name 0x7ffff78166c0
    type <enumeral_type 0x7ffff77f5f18 E
        type <integer_type 0x7ffff780b000 unsigned int public unsigned SI
            size <integer_cst 0x7ffff76bf0a8 constant 32>
            unit-size <integer_cst 0x7ffff76bf0c0 constant 4>
            align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff780b000 precision:5 min <integer_cst 0x7ffff7806378 0> max <integer_cst
0x7ffff7806390 31>>
        sizes-gimplified unsigned SI size <integer_cst 0x7ffff76bf0a8 32>
unit-size <integer_cst 0x7ffff76bf0c0 4>
        align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff77f5f18 precision:32 min <integer_cst 0x7ffff76bf0d8 0> max <integer_cst
0x7ffff76bf090 4294967295>
        values <tree_list 0x7ffff77f4488
            purpose <identifier_node 0x7ffff78079c0 e0
                normal local bindings <(nil)>> value <const_decl 0x7ffff780a000
e0>
            chain <tree_list 0x7ffff77f44b0
                purpose <identifier_node 0x7ffff7807a00 e1
                    normal local bindings <(nil)>> value <const_decl
0x7ffff780a070 e1>
                chain <tree_list 0x7ffff77f44d8
                    purpose <identifier_node 0x7ffff7807a40 e2
                        normal local bindings <(nil)>> value <const_decl
0x7ffff780a0e0 e2>
                    chain <tree_list 0x7ffff77f4500
                        purpose <identifier_node 0x7ffff7807a80 e3
                            normal local bindings <(nil)>> value <const_decl
0x7ffff780a150 e3>
                        chain <tree_list 0x7ffff77f4528 purpose
<identifier_node 0x7ffff7807ac0 e4> value <const_decl 0x7ffff780a1c0 e4> chain
<tree_list 0x7ffff77f4550>>>>>> context <translation_unit_decl 0x7ffff76ab168
/home/marxin/Programming/testcases/pr91351.cc>
        chain <type_decl 0x7ffff76cc850 E>>

    def_stmt _6 = e_2(D) + 4294967285;
    version:6>

So the integer_type of the enumeral_type hash precision:5 and:
min <integer_cst 0x7ffff7806378 0>

and

max <integer_cst 0x7ffff7806390 31>

which is what one would expect from -fstrict-enums.

Martin

Reply via email to