]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c++/56237 (ICE in lang_* check: failed in push_local_name, at cp...
authorJakub Jelinek <jakub@redhat.com>
Tue, 19 Feb 2013 17:21:08 +0000 (18:21 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 19 Feb 2013 17:21:08 +0000 (18:21 +0100)
Backported from mainline
2013-02-07  Jakub Jelinek  <jakub@redhat.com>

PR c++/56237
* decl.c (push_local_name): Look at DECL_DISCRIMINATOR (t)
only if DECL_DISCRIMINATOR_SET_P (t) rather than just
DECL_LANG_SPECIFIC (t).

* g++.dg/abi/mangle61.C: New test.

From-SVN: r196142

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/abi/mangle61.C [new file with mode: 0644]

index 3a6f02fdb6b5dca92113f932993c5ca5b7d788f5..28a5c601c943314e97b3e496400c3ac040bd5a56 100644 (file)
@@ -1,3 +1,13 @@
+2013-02-19  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2013-02-07  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/56237
+       * decl.c (push_local_name): Look at DECL_DISCRIMINATOR (t)
+       only if DECL_DISCRIMINATOR_SET_P (t) rather than just
+       DECL_LANG_SPECIFIC (t).
+
 2013-02-15  Jason Merrill  <jason@redhat.com>
 
        PR c++/54276
index 48143963e4dde4dae1e06e83f74f66bfe7642108..f200483afef51c66f8d9ae56c472751789d6ec66 100644 (file)
@@ -917,7 +917,7 @@ push_local_name (tree decl)
          if (!DECL_LANG_SPECIFIC (decl))
            retrofit_lang_decl (decl);
          DECL_LANG_SPECIFIC (decl)->u.base.u2sel = 1;
-         if (DECL_LANG_SPECIFIC (t))
+         if (DECL_DISCRIMINATOR_SET_P (t))
            DECL_DISCRIMINATOR (decl) = DECL_DISCRIMINATOR (t) + 1;
          else
            DECL_DISCRIMINATOR (decl) = 1;
index 2a6ef74491eff7528ce9e1f90b1283f8d375baa7..cfdbea6bbda5c79726eda6693d0e480d45079842 100644 (file)
@@ -1,6 +1,11 @@
 2013-02-19  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2013-02-07  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/56237
+       * g++.dg/abi/mangle61.C: New test.
+
        2013-02-06  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/56217
diff --git a/gcc/testsuite/g++.dg/abi/mangle61.C b/gcc/testsuite/g++.dg/abi/mangle61.C
new file mode 100644 (file)
index 0000000..2ae336e
--- /dev/null
@@ -0,0 +1,28 @@
+// PR c++/56237
+// { dg-do compile }
+
+void *p[4];
+
+void
+foo ()
+{
+  static union { } u;
+  p[0] = &u;
+  {
+    static union { } u; 
+    p[1] = &u;
+    {
+      static union { } u;
+      p[2] = &u;
+    }
+  }
+  {
+    static union { } u;
+    p[3] = &u;
+  }
+}
+
+// { dg-final { scan-assembler "_ZZ3foovE1u\[^_\]" } }
+// { dg-final { scan-assembler "_ZZ3foovE1u_0" } }
+// { dg-final { scan-assembler "_ZZ3foovE1u_1" } }
+// { dg-final { scan-assembler "_ZZ3foovE1u_2" } }