[Bug c++/65690] [5 Regression] typedef alignment lost since r219705

hubicka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 7 22:02:00 GMT 2015


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

--- Comment #1 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
We are constructing:
(gdb) p debug_tree (t)
 <array_type 0x7ffff6c57498
    type <array_type 0x7ffff6c57348
        type <real_type 0x7ffff6b02a80 double readonly DF
            size <integer_cst 0x7ffff6ad7e58 constant 64>
            unit size <integer_cst 0x7ffff6ad7e70 constant 8>
            align 64 symtab 0 alias set -1 canonical type 0x7ffff6b02a80
precision 64
            pointer_to_this <pointer_type 0x7ffff6b02b28>>
        BLK
        size <integer_cst 0x7ffff6af91c8 constant 256>
        unit size <integer_cst 0x7ffff6af92b8 constant 32>
        align 64 symtab 0 alias set -1 canonical type 0x7ffff6c57348
        domain <integer_type 0x7ffff6c44e70 type <integer_type 0x7ffff6adb0a8
sizetype>
            type_6 DI size <integer_cst 0x7ffff6ad7e58 64> unit size
<integer_cst 0x7ffff6ad7e70 8>
            align 64 symtab 0 alias set -1 canonical type 0x7ffff6c44e70
precision 64 min <integer_cst 0x7ffff6ad7e88 0> max <integer_cst 0x7ffff6c51be8
3>>>
    VOID
    align 8 symtab 0 alias set -1 canonical type 0x7ffff6c57498 domain
<integer_type 0x7ffff6c44e70>>
$12 = void

as a variant of:
(gdb) p debug_tree (m)
 <array_type 0x7ffff6c570a8
    type <array_type 0x7ffff6c44f18
        type <real_type 0x7ffff6afd498 double DF
            size <integer_cst 0x7ffff6ad7e58 constant 64>
            unit size <integer_cst 0x7ffff6ad7e70 constant 8>
            align 64 symtab 0 alias set -1 canonical type 0x7ffff6afd498
precision 64
            pointer_to_this <pointer_type 0x7ffff6afd690>>
        BLK
        size <integer_cst 0x7ffff6af91c8 constant 256>
        unit size <integer_cst 0x7ffff6af92b8 constant 32>
        align 64 symtab 0 alias set -1 canonical type 0x7ffff6c44f18
        domain <integer_type 0x7ffff6c44e70 type <integer_type 0x7ffff6adb0a8
sizetype>
            type_6 DI size <integer_cst 0x7ffff6ad7e58 64> unit size
<integer_cst 0x7ffff6ad7e70 8>
            align 64 symtab 0 alias set -1 canonical type 0x7ffff6c44e70
precision 64 min <integer_cst 0x7ffff6ad7e88 0> max <integer_cst 0x7ffff6c51be8
3>>
        pointer_to_this <pointer_type 0x7ffff6c57150>>
    BLK
    size <integer_cst 0x7ffff6c26900 type <integer_type 0x7ffff6adb150
bitsizetype> constant 1024>
    unit size <integer_cst 0x7ffff6c51c18 type <integer_type 0x7ffff6adb0a8
sizetype> constant 128>
    align 64 symtab 0 alias set -1 canonical type 0x7ffff6c570a8 domain
<integer_type 0x7ffff6c44e70>>
$13 = void

From:

#0  build_cplus_array_type (elt_type=0x7ffff6c57348, index_type=0x7ffff6c44e70)
at ../../gcc/cp/tree.c:884
#1  0x000000000080a2bb in cp_build_qualified_type_real (type=0x7ffff6c571f8,
type_quals=1, complain=7) at ../../gcc/cp/tree.c:1068
#2  0x0000000000703f8e in grokdeclarator (declarator=0x0, declspecs=0x20b3978,
decl_context=PARM, initialized=0, attrlist=0x20b39d8) at
../../gcc/cp/decl.c:9487

So it is construction of "const T".  For some reason layout_type then drops the
user alignment from the main variant.  Who is supposed to copy the alignment to
the qualified variant?

layout_type does:
TYPE_ALIGN (type) = MAX (TYPE_ALIGN (element), BITS_PER_UNIT);
TYPE_USER_ALIGN (type) = TYPE_USER_ALIGN (element);

and finally copies it to all variants in finalize_type_size.



More information about the Gcc-bugs mailing list