OSDN Git Service

Backported from mainline
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 19 Feb 2013 17:21:08 +0000 (17:21 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 19 Feb 2013 17:21:08 +0000 (17:21 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@196142 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 3a6f02f..28a5c60 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 4814396..f200483 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 2a6ef74..cfdbea6 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" } }