From: Jakub Jelinek Date: Thu, 8 Jan 2009 00:23:48 +0000 (+0100) Subject: re PR c++/38725 (ICE with goto) X-Git-Tag: releases/gcc-4.4.0~970 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f5651df1abb64343a5e18ed6af8cde899d4b2198;p=thirdparty%2Fgcc.git re PR c++/38725 (ICE with goto) PR c++/38725 * semantics.c (finish_goto_stmt): Convert destination to void *. * g++.dg/ext/label11.C: New test. From-SVN: r143177 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e1539c5d07b2..a0be740d5dcc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2009-01-07 Jakub Jelinek + + PR c++/38725 + * semantics.c (finish_goto_stmt): Convert destination to + void *. + 2009-01-06 Jason Merrill PR c++/35297 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 782b1ddda1d0..c9f0641f5f84 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -547,7 +547,12 @@ finish_goto_stmt (tree destination) { /* The DESTINATION is being used as an rvalue. */ if (!processing_template_decl) - destination = decay_conversion (destination); + { + destination = decay_conversion (destination); + destination = cp_convert (ptr_type_node, destination); + if (error_operand_p (destination)) + return NULL_TREE; + } /* We don't inline calls to functions with computed gotos. Those functions are typically up to some funny business, and may be depending on the labels being at particular diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 196f19136610..6b7d3e70015a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-01-07 Jakub Jelinek + + PR c++/38725 + * g++.dg/ext/label11.C: New test. + 2009-01-07 Joseph Myers * lib/target-supports.exp (check_weak_override_available): New. diff --git a/gcc/testsuite/g++.dg/ext/label11.C b/gcc/testsuite/g++.dg/ext/label11.C new file mode 100644 index 000000000000..dd922286064b --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/label11.C @@ -0,0 +1,46 @@ +// PR c++/38725 +// { dg-do compile } +// { dg-options "" } + +struct A {}; +struct B : virtual A {}; +int vi; +void *vp; + +void +f1 (int i) +{ + goto *i; +} + +void +f2 (B b) +{ + goto *b; // { dg-error "cannot convert" } +} + +template +void +f3 (T i) +{ + goto *i; +} + +void +f3a () +{ + f3 (vi); +} + +template +void +f4 (T i) +{ + goto *i; +} + +void +f4a () +{ + f4 (vp); +}