diff options
author | Marek Polacek <polacek@redhat.com> | 2016-03-15 21:10:11 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2016-03-15 21:10:11 +0000 |
commit | 42c729c52e91374b3af861eeff7b6cfaa77d9712 (patch) | |
tree | d4e064b7be595d7220f92d6a75b5b31084b35e93 | |
parent | d1ccf407dad8237e32c2d5a2d121dbd9c53483c7 (diff) | |
download | gcc-42c729c52e91374b3af861eeff7b6cfaa77d9712.zip gcc-42c729c52e91374b3af861eeff7b6cfaa77d9712.tar.gz gcc-42c729c52e91374b3af861eeff7b6cfaa77d9712.tar.bz2 |
re PR c++/70209 (ICE in strip_typedefs, at cp/tree.c:1377)
PR c++/70209
* tree.c (strip_typedefs): Call strip_typedefs again on the
DECL_ORIGINAL_TYPE result.
* g++.dg/ext/attribute-may-alias-4.C: New test.
From-SVN: r234234
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/tree.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/attribute-may-alias-4.C | 17 |
4 files changed, 34 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index eff989b..4499284 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-03-15 Marek Polacek <polacek@redhat.com> + + PR c++/70209 + * tree.c (strip_typedefs): Call strip_typedefs again on the + DECL_ORIGINAL_TYPE result. + 2016-03-15 Jason Merrill <jason@redhat.com> PR c++/70095 diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index aaf9a4f..f784952 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1460,9 +1460,12 @@ strip_typedefs (tree t, bool *remove_attributes) if (!result) { if (typedef_variant_p (t)) - /* Explicitly get the underlying type, as TYPE_MAIN_VARIANT doesn't - strip typedefs with attributes. */ - result = TYPE_MAIN_VARIANT (DECL_ORIGINAL_TYPE (TYPE_NAME (t))); + { + /* Explicitly get the underlying type, as TYPE_MAIN_VARIANT doesn't + strip typedefs with attributes. */ + result = TYPE_MAIN_VARIANT (DECL_ORIGINAL_TYPE (TYPE_NAME (t))); + result = strip_typedefs (result); + } else result = TYPE_MAIN_VARIANT (t); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2a76ef0..3eb5710 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-03-15 Marek Polacek <polacek@redhat.com> + + PR c++/70209 + * g++.dg/ext/attribute-may-alias-4.C: New test. + 2016-03-15 Alexander Monakov <amonakov@ispras.ru> * g++.dg/pr63384.C: Add -w to dg-options. Remove '-toggle' in diff --git a/gcc/testsuite/g++.dg/ext/attribute-may-alias-4.C b/gcc/testsuite/g++.dg/ext/attribute-may-alias-4.C new file mode 100644 index 0000000..a459d49 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attribute-may-alias-4.C @@ -0,0 +1,17 @@ +// PR c++/70209 + +struct V { + typedef float F; + template <typename S> void m_fn1(S); +}; + +template <typename> struct A { + typedef V::F Ta __attribute__((__may_alias__)); + Ta *m_data; + void m_fn2(V &); +}; + +template <> +void A<int>::m_fn2(V &p) { + p.m_fn1(m_data); +} |