diff options
author | Jason Merrill <jason@redhat.com> | 2009-12-04 20:51:46 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2009-12-04 20:51:46 -0500 |
commit | 364f9c6bf65b5d01561f622a42a8a508a3009300 (patch) | |
tree | 2eb63ab5db50c37e458fdf6eaa1769ab49a7f082 | |
parent | b50eb277c1c3eef6f81de369130aca3ee9fff5a0 (diff) | |
download | gcc-364f9c6bf65b5d01561f622a42a8a508a3009300.zip gcc-364f9c6bf65b5d01561f622a42a8a508a3009300.tar.gz gcc-364f9c6bf65b5d01561f622a42a8a508a3009300.tar.bz2 |
re PR c++/42010 ([C++0x] ICE: lang_* check: failed in discriminator_for_local_entity, at cp/mangle.c:1581)
PR c++/42010
* cp-tree.h (DECL_DISCRIMINATOR_SET_P): New.
* mangle.c (discriminator_for_local_entity): Check it.
From-SVN: r155007
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 4 | ||||
-rw-r--r-- | gcc/cp/mangle.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/abi/local2.C | 17 |
5 files changed, 30 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7ec27d4..bb3f8f9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2009-12-04 Jason Merrill <jason@redhat.com> + PR c++/42010 + * cp-tree.h (DECL_DISCRIMINATOR_SET_P): New. + * mangle.c (discriminator_for_local_entity): Check it. + PR c++/42277 * semantics.c (finish_decltype_type): Defer handling of decltype of a non-dependent COMPONENT_REF in a template. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index dc563e2..21a914d 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -2052,6 +2052,10 @@ struct GTY(()) lang_decl { /* Discriminator for name mangling. */ #define DECL_DISCRIMINATOR(NODE) (LANG_DECL_U2_CHECK (NODE, 1)->discriminator) +/* True iff DECL_DISCRIMINATOR is set for a DECL_DISCRIMINATOR_P decl. */ +#define DECL_DISCRIMINATOR_SET_P(NODE) \ + (DECL_LANG_SPECIFIC (NODE) && DECL_LANG_SPECIFIC (NODE)->u.base.u2sel == 1) + /* The index of a user-declared parameter in its function, starting at 1. All artificial parameters will have index 0. */ #define DECL_PARM_INDEX(NODE) \ diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index cd2b7d7..3afc094 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -1577,11 +1577,11 @@ discriminator_for_local_entity (tree entity) { if (DECL_DISCRIMINATOR_P (entity)) { - if (DECL_LANG_SPECIFIC (entity)) + if (DECL_DISCRIMINATOR_SET_P (entity)) return DECL_DISCRIMINATOR (entity); else /* The first entity with a particular name doesn't get - DECL_LANG_SPECIFIC/DECL_DISCRIMINATOR. */ + DECL_DISCRIMINATOR set up. */ return 0; } else if (TREE_CODE (entity) == TYPE_DECL) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ed866cf..12a57bc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2009-12-04 Jason Merrill <jason@redhat.com> + PR c++/42010 + * g++.dg/abi/local2.C: New. + PR c++/42277 * g++.dg/cpp0x/decltype20.C: New. diff --git a/gcc/testsuite/g++.dg/abi/local2.C b/gcc/testsuite/g++.dg/abi/local2.C new file mode 100644 index 0000000..f567016 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/local2.C @@ -0,0 +1,17 @@ +// PR c++/42010 +// { dg-final { scan-assembler "ZZN1A1fEvE1s" } } + +struct A { + static int f() + { + static struct { + int i; + } s; + return s.i; + } +}; + +int main() +{ + return A::f(); +} |