From patchwork Wed Nov 27 23:48:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 294706 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 51F642C00A1 for ; Thu, 28 Nov 2013 10:49:16 +1100 (EST) 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=OducrK6HeVtlXS5ujzcn7SLx6F5ftD+6bEnDz9MD+vT p7oQLwFORqvddyCDeofriV8yQPiZQhdJxFCbDci7D4wWUeyeiJ2h8aXTEo89NPNs JdpANzzoR2rgV9fquuaX8EoZV0vy726jW8m8pvgYL+XPvn3armVrVYrD9wbsFlcE = 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=Aa7by0D8HoPTHt6SmLMoRTMiFjg=; b=cpuY0ULfsz+tpYvZl GrJ9qF3RlTxKxXz1MNJxWklfFJXlguAAmcV506IdNzqEBnRZz+f2DVdV/ufSgg+Z ccmMGND/mzJt22HiROyFvPgQTpp340s4M/8f8D6UdW8dfDrVtsQZDoHY0/0/biCc FUyW/ktwZbvVSrxesi4yjU2C60= Received: (qmail 27950 invoked by alias); 27 Nov 2013 23:49:06 -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 27941 invoked by uid 89); 27 Nov 2013 23:49:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_50, RDNS_NONE, SPF_HELO_PASS, SPF_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from Unknown (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 27 Nov 2013 23:49:05 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rARNmvMk004689 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 27 Nov 2013 18:48:57 -0500 Received: from tucnak.zalov.cz (vpn1-4-58.ams2.redhat.com [10.36.4.58]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rARNmtjO024978 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 27 Nov 2013 18:48:57 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.7/8.14.7) with ESMTP id rARNmsHe017872 for ; Thu, 28 Nov 2013 00:48:54 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.7/8.14.7/Submit) id rARNmshv017871 for gcc-patches@gcc.gnu.org; Thu, 28 Nov 2013 00:48:54 +0100 Date: Thu, 28 Nov 2013 00:48:54 +0100 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org Subject: [committed] Fix -fopenmp-simd (PR c/59310) Message-ID: <20131127234854.GH892@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Hi! This patch (well, the first hunk) fixes a bug where p_name was uninitialized for -fopenmp-simd and we were strcating to it. The second hunk removes a bogus ATTRIBUTE_UNUSED parameter and unused p_name variable I've noticed while looking around, and the C++ FE hunk makes sure we don't call keep_next_level for -fopenmp-simd (because we don't call then begin_omp_structured_block and thus it keeps probably completely unrelated block later on). Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk. 2013-11-28 Jakub Jelinek PR c/59310 * c-parser.c (c_parser_omp_target): Copy "#pragma omp target" to p_name before calling c_parser_omp_teams instead of after. (c_parser_cilk_simd): Remove wrong ATTRIBUTE_UNUSED from parser argument. Remove unused p_name variable. * parser.c (cp_parser_omp_target): Call keep_next_level only if flag_openmp. Jakub --- gcc/c/c-parser.c.jj 2013-11-22 21:03:06.000000000 +0100 +++ gcc/c/c-parser.c 2013-11-27 16:04:39.818103277 +0100 @@ -12529,10 +12529,10 @@ c_parser_omp_target (c_parser *parser, e "parallel for simd")]; c_parser_consume_token (parser); + strcpy (p_name, "#pragma omp target"); if (!flag_openmp) /* flag_openmp_simd */ return c_parser_omp_teams (loc, parser, p_name, OMP_TARGET_CLAUSE_MASK, cclauses); - strcpy (p_name, "#pragma omp target"); keep_next_level (); tree block = c_begin_compound_stmt (true); tree ret = c_parser_omp_teams (loc, parser, p_name, @@ -13566,10 +13566,8 @@ c_parser_cilk_all_clauses (c_parser *par loops. */ static void -c_parser_cilk_simd (c_parser *parser ATTRIBUTE_UNUSED) +c_parser_cilk_simd (c_parser *parser) { - char p_name[100]; - strcpy (p_name, "#pragma omp"); tree clauses = c_parser_cilk_all_clauses (parser); tree block = c_begin_compound_stmt (true); location_t loc = c_parser_peek_token (parser)->location; --- gcc/cp/parser.c.jj 2013-11-26 21:39:17.000000000 +0100 +++ gcc/cp/parser.c 2013-11-27 16:06:30.552529617 +0100 @@ -29968,10 +29968,10 @@ cp_parser_omp_target (cp_parser *parser, cp_lexer_consume_token (parser->lexer); strcpy (p_name, "#pragma omp target"); - keep_next_level (true); if (!flag_openmp) /* flag_openmp_simd */ return cp_parser_omp_teams (parser, pragma_tok, p_name, OMP_TARGET_CLAUSE_MASK, cclauses); + keep_next_level (true); tree sb = begin_omp_structured_block (); unsigned save = cp_parser_begin_omp_structured_block (parser); tree ret = cp_parser_omp_teams (parser, pragma_tok, p_name,