From patchwork Wed Mar 22 18:55:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 742292 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 3vpJmc24cYz9s3w for ; Thu, 23 Mar 2017 05:55:59 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="uqMm88JB"; 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:reply-to:mime-version:content-type; q=dns; s=default; b=c4fgcLEQ3xawGPBns7ee+Zt/KEhmgveBxmUWHGSLZo7 40Y8bBbPf0VwHI8Y0RsqtKYjMKiZmyH09MwPRxpAb4Hg/64DSokaiu8rxfIdAy0M cg8eigQFcbtjBGCI12/lIiK+lgiZdqNWLNgoBPyJaEmb4nAipqpMhMASy8u8z2S4 = 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:reply-to:mime-version:content-type; s=default; bh=uCvMQ+Ys/eYe25xwE3h5MGoxl6g=; b=uqMm88JBVuLMkbqlb A3Jz5LTIrJr7D6gLwU1iyY9yjNIzxEEyeuvZ3jBsyj1WYZjPSBYJ/5Ma5LElea7g u8lITkGljUyLeHK3p8Vuusyxpo0RJzaYeOhclf5wOEHwURnh5oALz2M2roKJ/6Jn Qz+5/BhWbF3AlyDT3wLNARexhE= Received: (qmail 76325 invoked by alias); 22 Mar 2017 18:55:48 -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 76263 invoked by uid 89); 22 Mar 2017 18:55:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=unhappy 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; Wed, 22 Mar 2017 18:55:46 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6011A65D03 for ; Wed, 22 Mar 2017 18:55:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6011A65D03 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jakub@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6011A65D03 Received: from tucnak.zalov.cz (ovpn-116-72.ams2.redhat.com [10.36.116.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 07C4C17A9D for ; Wed, 22 Mar 2017 18:55:46 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id v2MIthgm014656 for ; Wed, 22 Mar 2017 19:55:43 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id v2MItg27014655 for gcc-patches@gcc.gnu.org; Wed, 22 Mar 2017 19:55:42 +0100 Date: Wed, 22 Mar 2017 19:55:42 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [committed] Fix OpenMP ICE with templates (PR c++/80141) Message-ID: <20170322185542.GJ11094@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes Hi! As can be seen on the testcase, apparently it is a bad idea to call maybe_constant_value when processing_template_decl, e.g. the 2 && 2 is at that point still 2 && 2 rather than true && true and constexpr code is unhappy about that. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk so far. 2017-03-22 Jakub Jelinek PR c++/80141 * semantics.c (finish_omp_clause) : Call maybe_constant_value only when not processing_template_decl. * g++.dg/gomp/pr80141.C: New test. Jakub --- gcc/cp/semantics.c.jj 2017-02-27 15:19:14.000000000 +0100 +++ gcc/cp/semantics.c 2017-03-22 15:46:34.003442833 +0100 @@ -6416,9 +6416,9 @@ finish_omp_clauses (tree clauses, enum c else { t = mark_rvalue_use (t); - t = maybe_constant_value (t); if (!processing_template_decl) { + t = maybe_constant_value (t); if (TREE_CODE (t) != INTEGER_CST || tree_int_cst_sgn (t) != 1) { @@ -6586,9 +6586,9 @@ finish_omp_clauses (tree clauses, enum c else { t = mark_rvalue_use (t); - t = maybe_constant_value (t); if (!processing_template_decl) { + t = maybe_constant_value (t); if (TREE_CODE (t) != INTEGER_CST || tree_int_cst_sgn (t) != 1) { --- gcc/testsuite/g++.dg/gomp/pr80141.C.jj 2017-03-22 17:37:52.445284214 +0100 +++ gcc/testsuite/g++.dg/gomp/pr80141.C 2017-03-22 17:35:53.000000000 +0100 @@ -0,0 +1,8 @@ +// PR c++/80141 +// { dg-do compile } + +#pragma omp declare simd aligned (p : 2 && 2) +template void foo (int *p); + +#pragma omp declare simd simdlen (2 && 2) +template void bar (int *p);