re PR c++/58635 ([c++11] ICE with __transaction_atomic and noexcept(false))

PR c++/58635
cp/
	* semantics.c (finish_return_stmt): Return error_mark_node
	when error_operand_p of the expr is true.
	(build_transaction_expr): Check for EXPR_P before setting the
	expr location.
testsuite/
	* g++.dg/tm/pr58635-1.C: New test.
	* g++.dg/tm/pr58635-2.C: New test.

From-SVN: r203323
This commit is contained in:
Marek Polacek 2013-10-09 14:51:28 +00:00 committed by Marek Polacek
parent 1dd2a9a0f3
commit 830ce0a2b3
5 changed files with 40 additions and 2 deletions

View File

@ -1,3 +1,11 @@
2013-10-09 Marek Polacek <polacek@redhat.com>
PR c++/58635
* semantics.c (finish_return_stmt): Return error_mark_node
when error_operand_p of the expr is true.
(build_transaction_expr): Check for EXPR_P before setting the
expr location.
2013-10-08 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58568

View File

@ -787,7 +787,8 @@ finish_return_stmt (tree expr)
expr = check_return_expr (expr, &no_warning);
if (flag_openmp && !check_omp_return ())
if (error_operand_p (expr)
|| (flag_openmp && !check_omp_return ()))
return error_mark_node;
if (!processing_template_decl)
{
@ -5221,7 +5222,8 @@ build_transaction_expr (location_t loc, tree expr, int flags, tree noex)
if (noex)
{
expr = build_must_not_throw_expr (expr, noex);
SET_EXPR_LOCATION (expr, loc);
if (EXPR_P (expr))
SET_EXPR_LOCATION (expr, loc);
TREE_SIDE_EFFECTS (expr) = 1;
}
ret = build1 (TRANSACTION_EXPR, TREE_TYPE (expr), expr);

View File

@ -1,3 +1,9 @@
2013-10-09 Marek Polacek <polacek@redhat.com>
PR c++/58635
* g++.dg/tm/pr58635-1.C: New test.
* g++.dg/tm/pr58635-2.C: New test.
2013-10-09 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/vect/bb-slp-31.c: Add cleanup-tree-dump.

View File

@ -0,0 +1,14 @@
// { dg-do compile }
// { dg-options "-std=c++11 -fgnu-tm" }
int
foo (void)
{
return __transaction_atomic noexcept(false) (false);
}
int
bar (int i)
{
return __transaction_atomic noexcept(false) (i);
}

View File

@ -0,0 +1,8 @@
// { dg-do compile }
// { dg-options "-std=c++11 -fgnu-tm" }
int
foo (void)
{
return __transaction_atomic noexcept(false) (x); // { dg-error "was not declared in this scope" }
}