diff options
author | Richard Biener <rguenther@suse.de> | 2018-07-12 07:13:36 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2018-07-12 07:13:36 +0000 |
commit | cd0762f3ca925ceaf69ae83442e08615fc1674e3 (patch) | |
tree | 6929b0f9adbbe1835a3db9c1c962b36c3c168679 | |
parent | 9e392989053729d4d50681e1742e2920d3b08ee4 (diff) | |
download | gcc-cd0762f3ca925ceaf69ae83442e08615fc1674e3.zip gcc-cd0762f3ca925ceaf69ae83442e08615fc1674e3.tar.gz gcc-cd0762f3ca925ceaf69ae83442e08615fc1674e3.tar.bz2 |
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
-rw-r--r-- | gcc/c-family/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-family/c-attribs.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/warn/pr86453.C | 5 |
4 files changed, 24 insertions, 2 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index a459f06..115e032 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,10 @@ +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> PR c++/86443 diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c index f91add4..8cb87eb 100644 --- a/gcc/c-family/c-attribs.c +++ b/gcc/c-family/c-attribs.c @@ -502,8 +502,13 @@ handle_packed_attribute (tree *node, tree name, tree ARG_UNUSED (args), if (TYPE_P (*node)) { 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) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0958a1a..d68cccf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 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 * gcc.dg/graphite/pr86479.c: New testcase. diff --git a/gcc/testsuite/g++.dg/warn/pr86453.C b/gcc/testsuite/g++.dg/warn/pr86453.C new file mode 100644 index 0000000..318f406 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/pr86453.C @@ -0,0 +1,5 @@ +// { dg-do compile } +// { dg-additional-options "-flto" { target lto } } +struct X { + int *__attribute__((aligned(2), packed)) a; // { dg-warning "attribute ignored" } +} b; |