Commit cd0762f3 by Richard Biener Committed by Richard Biener

re PR c/86453 (error: type variant differs by TYPE_PACKED in free_lang_data since r255469)

2018-07-12  Richard Biener  <rguenther@suse.de>

	PR c/86453
	* c-attribs.c (handle_packed_attribute): Do not build a variant
	type with TYPE_PACKED, instead ignore the attribute if we may
	not apply to the original type.

	* g++.dg/warn/pr86453.C: New testcase.

From-SVN: r262575
parent 9e392989
2018-07-12 Richard Biener <rguenther@suse.de>
PR c/86453
* c-attribs.c (handle_packed_attribute): Do not build a variant
type with TYPE_PACKED, instead ignore the attribute if we may
not apply to the original type.
2018-07-10 Jakub Jelinek <jakub@redhat.com> 2018-07-10 Jakub Jelinek <jakub@redhat.com>
PR c++/86443 PR c++/86443
......
...@@ -502,8 +502,13 @@ handle_packed_attribute (tree *node, tree name, tree ARG_UNUSED (args), ...@@ -502,8 +502,13 @@ handle_packed_attribute (tree *node, tree name, tree ARG_UNUSED (args),
if (TYPE_P (*node)) if (TYPE_P (*node))
{ {
if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE)) if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
*node = build_variant_type_copy (*node); {
TYPE_PACKED (*node) = 1; warning (OPT_Wattributes,
"%qE attribute ignored for type %qT", name, *node);
*no_add_attrs = true;
}
else
TYPE_PACKED (*node) = 1;
} }
else if (TREE_CODE (*node) == FIELD_DECL) else if (TREE_CODE (*node) == FIELD_DECL)
{ {
......
2018-07-12 Richard Biener <rguenther@suse.de> 2018-07-12 Richard Biener <rguenther@suse.de>
PR c/86453
* g++.dg/warn/pr86453.C: New testcase.
2018-07-12 Richard Biener <rguenther@suse.de>
PR middle-end/86479 PR middle-end/86479
* gcc.dg/graphite/pr86479.c: New testcase. * gcc.dg/graphite/pr86479.c: New testcase.
......
// { dg-do compile }
// { dg-additional-options "-flto" { target lto } }
struct X {
int *__attribute__((aligned(2), packed)) a; // { dg-warning "attribute ignored" }
} b;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment