From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11776 invoked by alias); 17 Mar 2017 14:45:50 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 11748 invoked by uid 89); 17 Mar 2017 14:45:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 17 Mar 2017 14:45:47 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3C2A77E9D2 for ; Fri, 17 Mar 2017 14:45:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3C2A77E9D2 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=polacek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3C2A77E9D2 Received: from redhat.com (ovpn-204-27.brq.redhat.com [10.40.204.27]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2HEjh4i023406 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 17 Mar 2017 10:45:47 -0400 Date: Fri, 17 Mar 2017 14:45:00 -0000 From: Marek Polacek To: GCC Patches , Jason Merrill Subject: C++ PATCH to fix ICE with noexcept and -fgnu-tm (PR c++/80059) Message-ID: <20170317144542.GB3172@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.7.1 (2016-10-04) X-SW-Source: 2017-03/txt/msg00935.txt.bz2 Paolo recently added the perform_implicit_conversion_flags call in build_must_not_throw_expr which means that COND might now be an IMPLICIT_CONV_EXPR. That means we need to make sure that COND is instantiated before we try to fold it, because we can get here while parsing a template. Me & Paolo discussed how to fix this, and I think the following is best. Bootstrapped/regtested on x86_64-linux, ok for trunk? 2017-03-17 Marek Polacek Paolo Carlini 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_sfinae (cond, tf_none); 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 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 int foo(bool b) +{ + return __transaction_atomic noexcept(b) (0); // { dg-error "is not a constant expression" } +} + +void bar() +{ + foo(true); +} Marek