https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67106
Jan Hubicka <hubicka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |joseph at codesourcery dot com
Component|debug |c
--- Comment #2 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Here start_struct set TYPE_PACKED in:
start_struct (loc=8576, code=RECORD_TYPE, name=0x7ffff6beeaf0,
enclosing_struct_parse_info=0x7fffffffe848) at ../../gcc/c/c-decl.c:7218
7218 *enclosing_struct_parse_info = struct_parse_info;
(gdb) l
7213 }
7214
7215 C_TYPE_BEING_DEFINED (ref) = 1;
7216 TYPE_PACKED (ref) = flag_pack_struct;
7217
7218 *enclosing_struct_parse_info = struct_parse_info;
7219 struct_parse_info = XNEW (struct c_struct_parse_info);
7220 struct_parse_info->struct_types.create (0);
7221 struct_parse_info->fields.create (0);
7222 struct_parse_info->typedefs_seen.create (0);
(
normally the TYPE_PACKED is copied to variants in finish_record_layout but in
this testcase the structure is never finished:
typedef struct S S;
struct S
{
struct
{
S *s;
};
int a;
};
<record_type 0x7ffff6bdb1f8 S packed type_0 VOID
align 8 symtab -155260016 alias set -1 canonical type 0x7ffff6bdb1f8
pointer_to_this <pointer_type 0x7ffff6bdb5e8> chain <type_decl
0x7ffff6afbd10 D.1755>>
<record_type 0x7ffff6bdb2a0 S VOID
align 8 symtab -155260096 alias set -1 canonical type 0x7ffff6bdb1f8
pointer_to_this <pointer_type 0x7ffff6bdb540> chain <type_decl
0x7ffff6afbd10 D.1755>>
I see three options
1) make start_struct to copy the flag to variants
2) drop verify_type checking for incomplette structures as TYPE_PACKED on
these is irrelevant
3) make C FE to set the flag only on functions being completed somewhere in
finish_struct.
I would preffer 1 or 3. Joseph, what would be best?