From patchwork Thu Feb 16 12:05:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 728575 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 3vPFGp28sNz9s8J for ; Thu, 16 Feb 2017 23:05:37 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="rmS07qMT"; 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=kL7N0A5xNVRWccS6VgCrJzXNlCQ6tLkDVTxnvj34Gwe dC8+uff/dfxTcqrfm1JkpeNaOvTWj6KIr3+OMcNj7Gw5vAEjY7zU4LkwP9RpSLx1 QJ7JPV2e409DiVONNn+O5D6oQyrCrwz1630NZpM4v2tzG6EEZgiriUsT/FaYdSA4 = 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=4GFF4/NW6AWUAANowVIXhSu4kms=; b=rmS07qMT00W75XLWM od6QiGSitad3ua3TYxJOD8tkQNc1KSGnKk+zi7gZEWgkhaOxLkWRm7pS0dkpdES0 lXLNvfTUjkyILnzTJrKCbTQTdki5Fhm4xTIXbUvlbsOOQlcq61EpMr7x40lU6HxG ohHWY0do2tMqzKQHUF4d6c9wQo= Received: (qmail 73352 invoked by alias); 16 Feb 2017 12:05:27 -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 73341 invoked by uid 89); 16 Feb 2017 12:05:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=parsercjj, UD:parser.c.jj, parser.c.jj 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; Thu, 16 Feb 2017 12:05:26 +0000 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 061D461D02 for ; Thu, 16 Feb 2017 12:05:26 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-117-76.ams2.redhat.com [10.36.117.76]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2712FB6800 for ; Thu, 16 Feb 2017 12:05:24 +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 v1GC5Ldf009010 for ; Thu, 16 Feb 2017 13:05:22 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id v1GC5KAc009009 for gcc-patches@gcc.gnu.org; Thu, 16 Feb 2017 13:05:20 +0100 Date: Thu, 16 Feb 2017 13:05:20 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [committed] Fix -fopenmp-simd #pragma omp target handling (PR c++/79512) Message-ID: <20170216120520.GB1849@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! Both C and C++ FE had forgotten case when #pragma omp target is not followed by any identifier token. We need to ignore the pragma in that case the same as we ignore it e.g. for #pragma omp target data etc. Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk. 2017-02-16 Jakub Jelinek PR c++/79512 c/ * c-parser.c (c_parser_omp_target): For -fopenmp-simd ignore #pragma omp target even when not followed by identifier. cp/ * parser.c (cp_parser_omp_target): For -fopenmp-simd ignore #pragma omp target even when not followed by identifier. testsuite/ * c-c++-common/gomp/pr79512.c: New test. Jakub --- gcc/c/c-parser.c.jj 2017-02-13 22:55:31.000000000 +0100 +++ gcc/c/c-parser.c 2017-02-15 15:48:19.688854692 +0100 @@ -16505,6 +16505,11 @@ c_parser_omp_target (c_parser *parser, e return c_parser_omp_target_update (loc, parser, context); } } + if (!flag_openmp) /* flag_openmp_simd */ + { + c_parser_skip_to_pragma_eol (parser, false); + return false; + } stmt = make_node (OMP_TARGET); TREE_TYPE (stmt) = void_type_node; --- gcc/cp/parser.c.jj 2017-02-14 20:34:48.000000000 +0100 +++ gcc/cp/parser.c 2017-02-15 15:49:32.803895243 +0100 @@ -35993,6 +35993,11 @@ cp_parser_omp_target (cp_parser *parser, return cp_parser_omp_target_update (parser, pragma_tok, context); } } + if (!flag_openmp) /* flag_openmp_simd */ + { + cp_parser_skip_to_pragma_eol (parser, pragma_tok); + return false; + } stmt = make_node (OMP_TARGET); TREE_TYPE (stmt) = void_type_node; --- gcc/testsuite/c-c++-common/gomp/pr79512.c.jj 2017-02-15 15:51:33.835307012 +0100 +++ gcc/testsuite/c-c++-common/gomp/pr79512.c 2017-02-15 15:51:12.000000000 +0100 @@ -0,0 +1,14 @@ +/* PR c++/79512 */ +/* { dg-options "-fopenmp-simd" } */ + +void +foo (void) +{ + #pragma omp target + #pragma omp teams + { + int i; + for (i = 0; i < 10; i++) + ; + } +}