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

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rsandifo at gcc dot 
gnu.org

--- Comment #2 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> 
---
Mine.  Looks like the problem was latent before.  The testcase
ends up using vector boolean types with 2-bit element types.
Before that patch we computed the TYPE_SIZE of the vector type as:

        TYPE_SIZE (type) = int_const_binop (MULT_EXPR,
                                            TYPE_SIZE (innertype),
                                            bitsize_int (nunits));

where the TYPE_SIZE of the boolean is 8 bits.  So the TYPE_SIZE
of the vector was 4*8 == 32 bits, even though the TYPE_SIZE_UNIT
was only 1 byte.  This meant that the BIT_FIELD_REFs passed the
tree-cfg.c checks but led to incorrect rtl:

;; _13 = { -1, -1, -1, -1 };

(insn 18 17 0 (set (reg:QI 92 [ _13 ])
        (const_int 15 [0xf])) "/tmp/pr94980.c":6:17 -1
     (nil))

;; _14 = BIT_FIELD_REF <_13, 8, 8>;

(insn 19 18 20 (set (mem/c:QI (plus:DI (reg/f:DI 77 virtual-stack-vars)
                (const_int -4 [0xfffffffffffffffc])) [2  S1 A8])
        (reg:QI 92 [ _13 ])) "/tmp/pr94980.c":6:17 -1
     (nil))

(insn 20 19 0 (set (reg:QI 93 [ _14 ])
        (mem/c:QI (plus:DI (reg/f:DI 77 virtual-stack-vars)
                (const_int -3 [0xfffffffffffffffd])) [0  S1 A8]))
"/tmp/pr94980.c":6:17 -1
     (nil))

where the last insn reads back uninitialised memory.

Reply via email to