re PR c++/52247 (ICE with asm goto)

PR c++/52247
	* 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.

From-SVN: r184229
This commit is contained in:
Jakub Jelinek 2012-02-14 20:51:01 +01:00 committed by Jakub Jelinek
parent 72824d5e40
commit 61c8513078
4 changed files with 40 additions and 2 deletions

View 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

View 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 (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);

View 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

View file

@ -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> ();
}