diff options
author | Marek Polacek <polacek@redhat.com> | 2013-10-09 14:51:28 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2013-10-09 14:51:28 +0000 |
commit | 830ce0a2b345f6d176d9b398892fb3fbbe9706b0 (patch) | |
tree | 269b4a41b7508b900bde3328f55991c3dcb2d0a1 /gcc | |
parent | 1dd2a9a0f34de177e1d27ea330f8050621c26b61 (diff) | |
download | gcc-830ce0a2b345f6d176d9b398892fb3fbbe9706b0.zip gcc-830ce0a2b345f6d176d9b398892fb3fbbe9706b0.tar.gz gcc-830ce0a2b345f6d176d9b398892fb3fbbe9706b0.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/tm/pr58635-1.C | 14 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/tm/pr58635-2.C | 8 |
5 files changed, 40 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 70dab1e..b3bde10 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index a7874e7..aa0490e 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7871e28..66b3c38 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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. diff --git a/gcc/testsuite/g++.dg/tm/pr58635-1.C b/gcc/testsuite/g++.dg/tm/pr58635-1.C new file mode 100644 index 0000000..9287e1b --- /dev/null +++ b/gcc/testsuite/g++.dg/tm/pr58635-1.C @@ -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); +} diff --git a/gcc/testsuite/g++.dg/tm/pr58635-2.C b/gcc/testsuite/g++.dg/tm/pr58635-2.C new file mode 100644 index 0000000..8a27bc4 --- /dev/null +++ b/gcc/testsuite/g++.dg/tm/pr58635-2.C @@ -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" } +} |