This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH to fix ICE with noexcept and -fgnu-tm (PR c++/80059)
- From: Marek Polacek <polacek at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 20 Mar 2017 15:36:23 +0100
- Subject: Re: C++ PATCH to fix ICE with noexcept and -fgnu-tm (PR c++/80059)
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=polacek at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6008C56FC
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6008C56FC
- References: <20170317144542.GB3172@redhat.com> <CADzB+2n2G-BkkM1hL22L_=34x1rY0z3HugTtV06OLJ2Vnhi5GQ@mail.gmail.com>
On Sat, Mar 18, 2017 at 12:47:39PM -0400, Jason Merrill wrote:
> On Fri, Mar 17, 2017 at 10:45 AM, Marek Polacek <polacek@redhat.com> wrote:
> > + cond = instantiate_non_dependent_expr_sfinae (cond, tf_none);
>
> Why this rather than instantiate_non_dependent_expr (and so tf_error)?
Hmm, I hadn't thought about that. But now I couldn't construct a testcase
where the _sfinae version would make a difference, so here it is without
the _sfinae:
Bootstrapped/regtested on x86_64-linux, ok for trunk?
2017-03-20 Marek Polacek <polacek@redhat.com>
Paolo Carlini <paolo.carlini@oracle.com>
PR c++/80059 - ICE with noexcept and __transaction_atomic
* except.c (build_must_not_throw_expr): Call
instantiate_non_dependent_expr_sfinae.
* g++.dg/tm/pr80059-2.C: New test.
* g++.dg/tm/pr80059.C: New test.
diff --git gcc/cp/except.c gcc/cp/except.c
index 45d00cc..298094e 100644
--- gcc/cp/except.c
+++ gcc/cp/except.c
@@ -271,6 +271,7 @@ build_must_not_throw_expr (tree body, tree cond)
cond = perform_implicit_conversion_flags (boolean_type_node, cond,
tf_warning_or_error,
LOOKUP_NORMAL);
+ cond = instantiate_non_dependent_expr (cond);
cond = cxx_constant_value (cond);
if (integer_zerop (cond))
return body;
diff --git gcc/testsuite/g++.dg/tm/pr80059-2.C gcc/testsuite/g++.dg/tm/pr80059-2.C
index e69de29..10edb3a 100644
--- gcc/testsuite/g++.dg/tm/pr80059-2.C
+++ gcc/testsuite/g++.dg/tm/pr80059-2.C
@@ -0,0 +1,13 @@
+// PR c++/80059
+// { dg-do compile { target c++11 } }
+// { dg-options "-fgnu-tm" }
+
+template<typename T> int foo(T b)
+{
+ return __transaction_atomic noexcept(b) (0); // { dg-error "is not a constant expression" }
+}
+
+void bar()
+{
+ foo(true);
+}
diff --git gcc/testsuite/g++.dg/tm/pr80059.C gcc/testsuite/g++.dg/tm/pr80059.C
index e69de29..1b705b6 100644
--- gcc/testsuite/g++.dg/tm/pr80059.C
+++ gcc/testsuite/g++.dg/tm/pr80059.C
@@ -0,0 +1,13 @@
+// PR c++/80059
+// { dg-do compile { target c++11 } }
+// { dg-options "-fgnu-tm" }
+
+template<typename> int foo(bool b)
+{
+ return __transaction_atomic noexcept(b) (0); // { dg-error "is not a constant expression" }
+}
+
+void bar()
+{
+ foo<int>(true);
+}
Marek