OSDN Git Service

PR c++/52247
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 14 Feb 2012 19:51:01 +0000 (19:51 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 14 Feb 2012 19:51:01 +0000 (19:51 +0000)
* pt.c (tsubst_copy_asm_operands): For LABEL_DECL values call
lookup_label on label's name and set TREE_USED.

* g++.dg/template/asmgoto1.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184229 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/asmgoto1.C [new file with mode: 0644]

index c20077c..f7cafec 100644 (file)
@@ -1,3 +1,9 @@
+2012-02-14  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/52247
+       * pt.c (tsubst_copy_asm_operands): For LABEL_DECL values call
+       lookup_label on label's name and set TREE_USED.
+
 2012-02-14  Jason Merrill  <jason@redhat.com>
 
        PR c++/39055
 2012-02-14  Jason Merrill  <jason@redhat.com>
 
        PR c++/39055
index a0b2a0b..c9cd953 100644 (file)
@@ -12612,8 +12612,17 @@ tsubst_copy_asm_operands (tree t, tree args, tsubst_flags_t complain,
   if (purpose)
     purpose = RECUR (purpose);
   value = TREE_VALUE (t);
   if (purpose)
     purpose = RECUR (purpose);
   value = TREE_VALUE (t);
-  if (value && TREE_CODE (value) != LABEL_DECL)
-    value = RECUR (value);
+  if (value)
+    {
+      if (TREE_CODE (value) != LABEL_DECL)
+       value = RECUR (value);
+      else
+       {
+         value = lookup_label (DECL_NAME (value));
+         gcc_assert (TREE_CODE (value) == LABEL_DECL);
+         TREE_USED (value) = 1;
+       }
+    }
   chain = TREE_CHAIN (t);
   if (chain && chain != void_type_node)
     chain = RECUR (chain);
   chain = TREE_CHAIN (t);
   if (chain && chain != void_type_node)
     chain = RECUR (chain);
index 67c9274..d82d7d5 100644 (file)
@@ -1,3 +1,8 @@
+2012-02-14  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/52247
+       * g++.dg/template/asmgoto1.C: New test.
+
 2012-02-14  Ian Lance Taylor  <iant@google.com>
 
        PR go/48501
 2012-02-14  Ian Lance Taylor  <iant@google.com>
 
        PR go/48501
diff --git a/gcc/testsuite/g++.dg/template/asmgoto1.C b/gcc/testsuite/g++.dg/template/asmgoto1.C
new file mode 100644 (file)
index 0000000..6a3cbce
--- /dev/null
@@ -0,0 +1,18 @@
+// PR c++/52247
+// { dg-do compile }
+
+template <int N>
+bool
+bar ()
+{
+  __asm goto ("" : : : : lab);
+  return true;
+lab:
+  return false;
+}
+
+bool
+foo ()
+{
+  return bar<0> ();
+}