From: Simon Martin Date: Mon, 29 Jan 2007 16:27:21 +0000 (+0000) Subject: re PR c++/28266 (ICE on invalid default variable) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=abc67de15a7ad0443fb5a6b17787c4d64c319d45;p=gcc.git re PR c++/28266 (ICE on invalid default variable) PR c++/28266 * gimplify.c (gimplify_target_expr): Make sure that the TARGET_EXPR is expanded only once even if an error occurs. From-SVN: r121288 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1ccb3c7bf37..9e4d1c43e7a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2007-01-29 Simon Martin + + PR c++/28266 + * gimplify.c (gimplify_target_expr): Make sure that the TARGET_EXPR is + expanded only once even if an error occurs. + 2007-01-29 Ben Elliston * gcov-io.h (__gcov_indirect_call_profiler): Declare. diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 19323ae59c3..1e9975777a3 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -4300,7 +4300,11 @@ gimplify_target_expr (tree *expr_p, tree *pre_p, tree *post_p) fb_none); } if (ret == GS_ERROR) - return GS_ERROR; + { + /* PR c++/28266 Make sure this is expanded only once. */ + TARGET_EXPR_INITIAL (targ) = NULL_TREE; + return GS_ERROR; + } append_to_statement_list (init, pre_p); /* If needed, push the cleanup for the temp. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 66501a914bc..aa9f672331e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-01-29 Simon Martin + + PR c++/28266 + * g++.dg/parse/defarg12.C: New test. + 2007-01-29 Paul Thomas PR fortran/30554 diff --git a/gcc/testsuite/g++.dg/parse/defarg12.C b/gcc/testsuite/g++.dg/parse/defarg12.C new file mode 100644 index 00000000000..3717ad5db7d --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/defarg12.C @@ -0,0 +1,13 @@ +/* PR28266 This used to ICE in gimple_add_tmp_var */ +/* { dg-do "compile" } */ + +struct A +{ + int i; + A(int = X); /* { dg-error "was not declared in this scope" }*/ +}; + +void foo() +{ + A().i; +}