From patchwork Fri Mar 17 14:45:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 740337 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vl7ST0svdz9ryj for ; Sat, 18 Mar 2017 01:46:00 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="GCDxcRdb"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=DU2CkC4zjdDdaTiewFrU+IoC0TmLtoGU+p/MscG2FN4HUSQqtQL37 kcZjiD/NevczMoPPFx0bMJN/oYrOF+J/UYTUKtbz8EJwfoYnRtYIJkw1ARvZNuOm z1zMJa37HlGy/aNrUwmn9S+tQe94Bt7lQbAfF0Lg/hi1VJFy55WOS0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=AMmS/yIbYgI6A5R3UvrJJn3m5N8=; b=GCDxcRdb/S6EO5YaGviU 7RDieozkjI7ckkH26cORxaGZY2XP4h6kK02JMBOAB2s0T3XYLbB8QwP4uZG20egN ezIKUtkHOEgo8LQCF/Om2EfvgvkTI+Akf4yNsuwKkgsFSMqtYfPHzTsqalubSJxf uT8nMph9tghOT/Bn7j2CZQM= 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-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@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 15:45:42 +0100 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-Disposition: inline User-Agent: Mutt/1.7.1 (2016-10-04) 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. Marek 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); +}