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



--- Comment #21 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2013-04-03 
08:51:44 UTC ---

> One of the C frontend issues is that the type of the address of

> the field of the packed struct is int *, not int attribute((aligned(1))) 

> *.  And this is so because nothing adjusts the type of the FIELD_DECL

> to be a less aligned type.  That is, we have

> 

>  <field_decl 0x7ffff6d245f0 i

>     type <integer_type 0x7ffff6d175e8 int public SI

>         size <integer_cst 0x7ffff6d1a0c0 constant 32>

>         unit size <integer_cst 0x7ffff6d1a0e0 constant 4>

>         align 32 symtab 0 alias set -1 canonical type 0x7ffff6d175e8 

> precision 32 min <integer_cst 0x7ffff6d1a060 -2147483648> max <integer_cst 

> 0x7ffff6d1a080 2147483647>

>         pointer_to_this <pointer_type 0x7ffff6d1f2a0>>

>     packed SI file t.c line 2 col 9 size <integer_cst 0x7ffff6d1a0c0 32> 

> unit size <integer_cst 0x7ffff6d1a0e0 4>

>     align 8 offset_align 128

>     offset <integer_cst 0x7ffff6d02d80 type <integer_type 0x7ffff6d17000 

> sizetype> constant 0>

>     bit offset <integer_cst 0x7ffff6d02e00 type <integer_type 

> 0x7ffff6d170a8 bitsizetype> constant 0> context <record_type 

> 0x7ffff6e1c3f0 Foo>>



This is on x86, right?  If the alignment of the field cannot be guaranteed to

be that of its type, then it should be made a bit-field.  Maybe it's already

made a bit-field on strict-alignment targets.

Reply via email to