This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/43798] attribute((aligned(x))) not honored for array element types?



------- Comment #1 from rguenth at gcc dot gnu dot org  2010-04-19 13:05 -------
Namely the bid_Kx192 decl looks like

 <var_decl 0x7ffff5af8000 bid_Kx192
    type <array_type 0x7ffff5add7e0
        type <record_type 0x7ffff5add690 UINT192 type_0 BLK
            size <integer_cst 0x7ffff7ef70c8 constant 192>
            unit size <integer_cst 0x7ffff7ef7078 constant 24>
            user align 128 symtab 0 alias set -1 canonical type 0x7ffff5add498
fields <field_decl 0x7ffff7fb34c0 w> context <translation_unit_decl
0x7ffff5afe000 D.1631>
            pointer_to_this <pointer_type 0x7ffff5add888>>
        BLK
        size <integer_cst 0x7ffff7ef7258 constant 6144>
        unit size <integer_cst 0x7ffff7fcfaa0 constant 768>
        user align 128 symtab 0 alias set -1 canonical type 0x7ffff5add9d8
        domain <integer_type 0x7ffff5add738>
        pointer_to_this <pointer_type 0x7ffff5afc000>>
    addressable used public static common BLK file t.c line 6 col 9 size
<integer_cst 0x7ffff7ef7258 6144> unit size <integer_cst 0x7ffff7fcfaa0 768>
    align 256 chain <function_decl 0x7ffff5adcb00 main>>

where the TYPE_ALIGN of the element type only applies to the first
array element.  If you look at expr.c:array_ref_element_size then you
can see that there doesn't exist a valid TREE_OPERAND (array-ref, 3)
for indexing the above array as its TYPE_ALIGN_UNIT is bigger than
the aligned-size.

IMHO the C frontend ought to generate a variant type for the element
type that has its alignment adjusted (or it shall follow the users
request and add padding between the elements?).  The current situation
is unfortunate for the middle-end.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jsm28 at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]