Skip to content

Commit 364f9c6

Browse files
jicamaJason Merrill
authored and
Jason Merrill
committed
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
1 parent b50eb27 commit 364f9c6

File tree

5 files changed

+30
-2
lines changed

5 files changed

+30
-2
lines changed

gcc/cp/ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
2009-12-04 Jason Merrill <[email protected]>
22

3+
PR c++/42010
4+
* cp-tree.h (DECL_DISCRIMINATOR_SET_P): New.
5+
* mangle.c (discriminator_for_local_entity): Check it.
6+
37
PR c++/42277
48
* semantics.c (finish_decltype_type): Defer handling of decltype
59
of a non-dependent COMPONENT_REF in a template.

gcc/cp/cp-tree.h

+4
Original file line numberDiff line numberDiff line change
@@ -2052,6 +2052,10 @@ struct GTY(()) lang_decl {
20522052
/* Discriminator for name mangling. */
20532053
#define DECL_DISCRIMINATOR(NODE) (LANG_DECL_U2_CHECK (NODE, 1)->discriminator)
20542054

2055+
/* True iff DECL_DISCRIMINATOR is set for a DECL_DISCRIMINATOR_P decl. */
2056+
#define DECL_DISCRIMINATOR_SET_P(NODE) \
2057+
(DECL_LANG_SPECIFIC (NODE) && DECL_LANG_SPECIFIC (NODE)->u.base.u2sel == 1)
2058+
20552059
/* The index of a user-declared parameter in its function, starting at 1.
20562060
All artificial parameters will have index 0. */
20572061
#define DECL_PARM_INDEX(NODE) \

gcc/cp/mangle.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1577,11 +1577,11 @@ discriminator_for_local_entity (tree entity)
15771577
{
15781578
if (DECL_DISCRIMINATOR_P (entity))
15791579
{
1580-
if (DECL_LANG_SPECIFIC (entity))
1580+
if (DECL_DISCRIMINATOR_SET_P (entity))
15811581
return DECL_DISCRIMINATOR (entity);
15821582
else
15831583
/* The first entity with a particular name doesn't get
1584-
DECL_LANG_SPECIFIC/DECL_DISCRIMINATOR. */
1584+
DECL_DISCRIMINATOR set up. */
15851585
return 0;
15861586
}
15871587
else if (TREE_CODE (entity) == TYPE_DECL)

gcc/testsuite/ChangeLog

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
2009-12-04 Jason Merrill <[email protected]>
22

3+
PR c++/42010
4+
* g++.dg/abi/local2.C: New.
5+
36
PR c++/42277
47
* g++.dg/cpp0x/decltype20.C: New.
58

gcc/testsuite/g++.dg/abi/local2.C

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// PR c++/42010
2+
// { dg-final { scan-assembler "ZZN1A1fEvE1s" } }
3+
4+
struct A {
5+
static int f()
6+
{
7+
static struct {
8+
int i;
9+
} s;
10+
return s.i;
11+
}
12+
};
13+
14+
int main()
15+
{
16+
return A::f();
17+
}

0 commit comments

Comments
 (0)