From patchwork Mon Feb 26 19:53:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 878062 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-473889-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="E7qXRFBr"; dkim-atps=neutral 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 3zqsvQ6z3pz9s1n for ; Tue, 27 Feb 2018 06:53:22 +1100 (AEDT) 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=P2hAe2LyZJgZ6ekrD9Vu5YfQHXz+cas1vqfY0TaW+Ix rz1s6QLbFMmSI72C/hc/rJynkgIuD4mRKo/VuyikeKKkNCPPqaerO3WljRCEW+nQ YpVSkoP/d/ySZqygsThBNJGZsJMZnc86Qn62sUd70cDfbNvU+2ZpNMffesFFLXpU = 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=okLkQN+SZHcCX1TY3wNsJ6+sdl8=; b=E7qXRFBrG6RFraK/N R9h4FklS08gQKfECLOYlKpcnRY/vkx/9w6TgUiOvB8Jkl8MsDwHvnbIcLnlTdhQ8 1PDNNe6RBx33xaZABdJm/bhvbfVTdpB7mxwM1YUOuGGDz8ZVCFUyL+ERC0fenh46 z8O7NnwW8rqfeNTMzpzgUkfK8U= Received: (qmail 81221 invoked by alias); 26 Feb 2018 19:53:15 -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 81203 invoked by uid 89); 26 Feb 2018 19:53:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-12.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:2081 X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 26 Feb 2018 19:53:14 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CD30740201A2 for ; Mon, 26 Feb 2018 19:53:07 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-204-85.brq.redhat.com [10.40.204.85]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8AD9B2024CA2 for ; Mon, 26 Feb 2018 19:53:07 +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 w1QJr5OL019747 for ; Mon, 26 Feb 2018 20:53:06 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id w1QJr5b9019746 for gcc-patches@gcc.gnu.org; Mon, 26 Feb 2018 20:53:05 +0100 Date: Mon, 26 Feb 2018 20:53:05 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [committed] Fix C++ OpenMP parsing ICE (PR c++/84557) Message-ID: <20180226195305.GX5867@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.1 (2017-09-22) X-IsSubscribed: yes Hi! In C++, the OpenMP variable lists are lists of id-expressions, which include template-ids; for those cp_parser_lookup_name_simple ICEs though, so this patch just calls that for identifiers similarly to other cp_parser_lookup_name_simple callers. Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk so far. 2018-02-26 Jakub Jelinek PR c++/84557 * parser.c (cp_parser_omp_var_list_no_open): Only call cp_parser_lookup_name_simple on names satisfying identifier_p. (cp_parser_oacc_routine): Likewise. * g++.dg/gomp/pr84557.C: New test. Jakub --- gcc/cp/parser.c.jj 2018-02-22 14:35:34.194215675 +0100 +++ gcc/cp/parser.c 2018-02-26 13:03:56.398478515 +0100 @@ -31339,7 +31339,10 @@ cp_parser_omp_var_list_no_open (cp_parse if (name == error_mark_node) goto skip_comma; - decl = cp_parser_lookup_name_simple (parser, name, token->location); + if (identifier_p (name)) + decl = cp_parser_lookup_name_simple (parser, name, token->location); + else + decl = name; if (decl == error_mark_node) cp_parser_name_lookup_error (parser, name, decl, NLE_NULL, token->location); @@ -37843,7 +37846,9 @@ cp_parser_oacc_routine (cp_parser *parse /*template_p=*/NULL, /*declarator_p=*/false, /*optional_p=*/false); - tree decl = cp_parser_lookup_name_simple (parser, name, name_loc); + tree decl = (identifier_p (name) + ? cp_parser_lookup_name_simple (parser, name, name_loc) + : name); if (name != error_mark_node && decl == error_mark_node) cp_parser_name_lookup_error (parser, name, decl, NLE_NULL, name_loc); --- gcc/testsuite/g++.dg/gomp/pr84557.C.jj 2018-02-26 13:04:34.074472152 +0100 +++ gcc/testsuite/g++.dg/gomp/pr84557.C 2018-02-26 13:04:17.014475036 +0100 @@ -0,0 +1,14 @@ +// PR c++/84557 +// { dg-do compile } + +template struct A {}; +template struct B {}; + +void +foo () +{ + #pragma omp parallel firstprivate (A) // { dg-error "is not a variable in clause" } + ; + #pragma omp parallel firstprivate (B<0>) // { dg-error "is not a variable in clause" } + ; +}