From patchwork Mon Oct 26 22:35:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cesar Philippidis X-Patchwork-Id: 536333 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 D11361412FD for ; Tue, 27 Oct 2015 09:35:36 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=XK7Xc5Y3; 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=boVFf2zYSuzg+t5IC wALo8e1SOcIIb25Ssam7S1c3ZuNUR3bkSZyskdo+tG56sCukWlGSgb1NUX6P0Yqe gYJMowqgzK1cB6pLk84BSCet+fmSvUZr+r9kNH3GnyMLKI5QBM8okoEri5AiwxBe DUtEIOOJDA8VjkLwgZbmgPPkRs= 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=E+NvxOdTvQxyBQiB1StsVE5 aL7M=; b=XK7Xc5Y3zP+XtOA43ZTIOngip5hriyMRdX5yWEdhQICD5O91xXwWwUw jvPsf8kQ+CD4eCyAkSc/5cpzbzeLxc01WCCLqYqR0l0VB0TED/JB+rO+gMVJuZs2 dRxgZk1QJaXo58hKGBM4D1aaqRiT2G1MckzMY+mO2kazUQmt0ePw= Received: (qmail 21963 invoked by alias); 26 Oct 2015 22:35:28 -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 21954 invoked by uid 89); 26 Oct 2015 22:35:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 26 Oct 2015 22:35:24 +0000 Received: from svr-orw-fem-05.mgc.mentorg.com ([147.34.97.43]) by relay1.mentorg.com with esmtp id 1ZqqML-0003Pn-Ee from Cesar_Philippidis@mentor.com ; Mon, 26 Oct 2015 15:35:21 -0700 Received: from [127.0.0.1] (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.3.224.2; Mon, 26 Oct 2015 15:35:21 -0700 Subject: Re: [OpenACC 5/11] C++ FE changes To: Jakub Jelinek References: <20151022085214.GG478@tucnak.redhat.com> <562A97C6.20909@codesourcery.com> <562AEEDE.5070207@mentor.com> <562BF40D.9070801@mentor.com> <20151026102030.GP478@tucnak.redhat.com> CC: Nathan Sidwell , GCC Patches , Bernd Schmidt , Jason Merrill , "Joseph S. Myers" From: Cesar Philippidis Message-ID: <562EAAA8.1080506@mentor.com> Date: Mon, 26 Oct 2015 15:35:20 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20151026102030.GP478@tucnak.redhat.com> On 10/26/2015 03:20 AM, Jakub Jelinek wrote: > On Sat, Oct 24, 2015 at 02:11:41PM -0700, Cesar Philippidis wrote: >> --- a/gcc/cp/semantics.c >> +++ b/gcc/cp/semantics.c >> @@ -5911,6 +5911,31 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd) >> bitmap_set_bit (&firstprivate_head, DECL_UID (t)); >> goto handle_field_decl; >> >> + case OMP_CLAUSE_GANG: >> + case OMP_CLAUSE_VECTOR: >> + case OMP_CLAUSE_WORKER: >> + /* Operand 0 is the num: or length: argument. */ >> + t = OMP_CLAUSE_OPERAND (c, 0); >> + if (t == NULL_TREE) >> + break; >> + >> + if (!processing_template_decl) >> + t = fold_build_cleanup_point_expr (TREE_TYPE (t), t); >> + OMP_CLAUSE_OPERAND (c, 0) = t; >> + >> + if (OMP_CLAUSE_CODE (c) != OMP_CLAUSE_GANG) >> + break; > > I think it would be better to do the Operand 1 stuff first for > case OMP_CLAUSE_GANG: only, and then have /* FALLTHRU */ into > case OMP_CLAUSE_{VECTOR,WORKER}: which would handle the first argument. > > You should add testing that the operand has INTEGRAL_TYPE_P type > (except that for processing_template_decl it can be > type_dependent_expression_p instead of INTEGRAL_TYPE_P). > > Also, the if (t == NULL_TREE) stuff looks fishy, because e.g. right now > if you have OMP_CLAUSE_GANG gang (static: expr) or similar, > you wouldn't wrap the expr into cleanup point. > So, instead it should be > if (t) > { > if (t == error_mark_node) > remove = true; > else if (!type_dependent_expression_p (t) > && !INTEGRAL_TYPE_P (TREE_TYPE (t))) > { > error_at (OMP_CLAUSE_LOCATION (c), ...); > remove = true; > } > else > { > t = mark_rvalue_use (t); > if (!processing_template_decl) > t = fold_build_cleanup_point_expr (TREE_TYPE (t), t); > OMP_CLAUSE_OPERAND (c, 0) = t; > } > } > or so. Also, can the expressions be arbitrary integers, or just > non-negative, or positive? If it is INTEGER_CST, that is something that > could be checked here too. I ended up handling with with OMP_CLAUSE_NUM_*, since they all require positive integer expressions. The only exception was OMP_CLAUSE_GANG which has two optional arguments. >> else if (!type_dependent_expression_p (t) >> && !INTEGRAL_TYPE_P (TREE_TYPE (t))) >> { >> - error ("num_threads expression must be integral"); >> + switch (OMP_CLAUSE_CODE (c)) >> + { >> + case OMP_CLAUSE_NUM_TASKS: >> + error ("% expression must be integral"); break; >> + case OMP_CLAUSE_NUM_TEAMS: >> + error ("% expression must be integral"); break; >> + case OMP_CLAUSE_NUM_THREADS: >> + error ("% expression must be integral"); break; >> + case OMP_CLAUSE_NUM_GANGS: >> + error ("% expression must be integral"); break; >> + case OMP_CLAUSE_NUM_WORKERS: >> + error ("% expression must be integral"); >> + break; >> + case OMP_CLAUSE_VECTOR_LENGTH: >> + error ("% expression must be integral"); >> + break; > > When touching these, can you please use error_at (OMP_CLAUSE_LOCATION (c), > instead of error ( ? Done >> + default: >> + error ("invalid argument"); > > What invalid argument? I'd say that is clearly gcc_unreachable (); case. > > But, I think it would be better to just use > error_at (OMP_CLAUSE_LOCATION (c), "%qs expression must be integral", > omp_clause_code_name[c]); I used that generic message for all of those clauses except for _GANG, _WORKER and _VECTOR. The gang clause, at the very least, needed it to disambiguate the static and num arguments. If you want I can handle _WORKER and _VECTOR with the generic message. I only included it because those arguments are optional, whereas they are mandatory for the other clauses. Is this patch OK for trunk? Cesar 2015-10-26 Cesar Philippidis Thomas Schwinge James Norris Joseph Myers Julian Brown Nathan Sidwell Bernd Schmidt gcc/cp/ * parser.c (cp_parser_omp_clause_name): Add auto, gang, seq, vector, worker. (cp_parser_oacc_simple_clause): New. (cp_parser_oacc_shape_clause): New. (cp_parser_oacc_all_clauses): Add auto, gang, seq, vector, worker. (OACC_LOOP_CLAUSE_MASK): Likewise. * semantics.c (finish_omp_clauses): Add auto, gang, seq, vector, worker. Unify the handling of teams, tasks and vector_length with the other loop shape clauses. 2015-10-26 Nathan Sidwell Cesar Philippidis gcc/testsuite/ * g++.dg/g++.dg/gomp/pr33372-1.C: Adjust diagnostic. * gcc/testsuite/g++.dg/gomp/pr33372-3.C: Likewise. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 7555bf3..5d07487 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -29064,7 +29064,9 @@ cp_parser_omp_clause_name (cp_parser *parser) { pragma_omp_clause result = PRAGMA_OMP_CLAUSE_NONE; - if (cp_lexer_next_token_is_keyword (parser->lexer, RID_IF)) + if (cp_lexer_next_token_is_keyword (parser->lexer, RID_AUTO)) + result = PRAGMA_OACC_CLAUSE_AUTO; + else if (cp_lexer_next_token_is_keyword (parser->lexer, RID_IF)) result = PRAGMA_OMP_CLAUSE_IF; else if (cp_lexer_next_token_is_keyword (parser->lexer, RID_DEFAULT)) result = PRAGMA_OMP_CLAUSE_DEFAULT; @@ -29122,7 +29124,9 @@ cp_parser_omp_clause_name (cp_parser *parser) result = PRAGMA_OMP_CLAUSE_FROM; break; case 'g': - if (!strcmp ("grainsize", p)) + if (!strcmp ("gang", p)) + result = PRAGMA_OACC_CLAUSE_GANG; + else if (!strcmp ("grainsize", p)) result = PRAGMA_OMP_CLAUSE_GRAINSIZE; break; case 'h': @@ -29212,6 +29216,8 @@ cp_parser_omp_clause_name (cp_parser *parser) result = PRAGMA_OMP_CLAUSE_SECTIONS; else if (!strcmp ("self", p)) result = PRAGMA_OACC_CLAUSE_SELF; + else if (!strcmp ("seq", p)) + result = PRAGMA_OACC_CLAUSE_SEQ; else if (!strcmp ("shared", p)) result = PRAGMA_OMP_CLAUSE_SHARED; else if (!strcmp ("simd", p)) @@ -29238,7 +29244,9 @@ cp_parser_omp_clause_name (cp_parser *parser) result = PRAGMA_OMP_CLAUSE_USE_DEVICE_PTR; break; case 'v': - if (!strcmp ("vector_length", p)) + if (!strcmp ("vector", p)) + result = PRAGMA_OACC_CLAUSE_VECTOR; + else if (!strcmp ("vector_length", p)) result = PRAGMA_OACC_CLAUSE_VECTOR_LENGTH; else if (flag_cilkplus && !strcmp ("vectorlength", p)) result = PRAGMA_CILK_CLAUSE_VECTORLENGTH; @@ -29246,6 +29254,8 @@ cp_parser_omp_clause_name (cp_parser *parser) case 'w': if (!strcmp ("wait", p)) result = PRAGMA_OACC_CLAUSE_WAIT; + else if (!strcmp ("worker", p)) + result = PRAGMA_OACC_CLAUSE_WORKER; break; } } @@ -29582,6 +29592,146 @@ cp_parser_oacc_data_clause_deviceptr (cp_parser *parser, tree list) return list; } +/* OpenACC 2.0: + auto + independent + nohost + seq */ + +static tree +cp_parser_oacc_simple_clause (cp_parser * /* parser */, + enum omp_clause_code code, + tree list, location_t location) +{ + check_no_duplicate_clause (list, code, omp_clause_code_name[code], location); + tree c = build_omp_clause (location, code); + OMP_CLAUSE_CHAIN (c) = list; + return c; +} + +/* OpenACC: + + gang [( gang-arg-list )] + worker [( [num:] int-expr )] + vector [( [length:] int-expr )] + + where gang-arg is one of: + + [num:] int-expr + static: size-expr + + and size-expr may be: + + * + int-expr +*/ + +static tree +cp_parser_oacc_shape_clause (cp_parser *parser, omp_clause_code kind, + const char *str, tree list) +{ + const char *id = "num"; + cp_lexer *lexer = parser->lexer; + tree ops[2] = { NULL_TREE, NULL_TREE }, c; + location_t loc = cp_lexer_peek_token (lexer)->location; + + if (kind == OMP_CLAUSE_VECTOR) + id = "length"; + + if (cp_lexer_next_token_is (lexer, CPP_OPEN_PAREN)) + { + cp_lexer_consume_token (lexer); + + do + { + cp_token *next = cp_lexer_peek_token (lexer); + int idx = 0; + + /* Gang static argument. */ + if (kind == OMP_CLAUSE_GANG + && cp_lexer_next_token_is_keyword (lexer, RID_STATIC)) + { + cp_lexer_consume_token (lexer); + + if (!cp_parser_require (parser, CPP_COLON, RT_COLON)) + goto cleanup_error; + + idx = 1; + if (ops[idx] != NULL) + { + cp_parser_error (parser, "too many % arguments"); + goto cleanup_error; + } + + /* Check for the '*' argument. */ + if (cp_lexer_next_token_is (lexer, CPP_MULT)) + { + cp_lexer_consume_token (lexer); + ops[idx] = integer_minus_one_node; + + if (cp_lexer_next_token_is (lexer, CPP_COMMA)) + { + cp_lexer_consume_token (lexer); + continue; + } + else break; + } + } + /* Worker num: argument and vector length: arguments. */ + else if (cp_lexer_next_token_is (lexer, CPP_NAME) + && strcmp (id, IDENTIFIER_POINTER (next->u.value)) == 0 + && cp_lexer_nth_token_is (lexer, 2, CPP_COLON)) + { + cp_lexer_consume_token (lexer); /* id */ + cp_lexer_consume_token (lexer); /* ':' */ + } + + /* Now collect the actual argument. */ + if (ops[idx] != NULL_TREE) + { + cp_parser_error (parser, "unexpected argument"); + goto cleanup_error; + } + + tree expr = cp_parser_assignment_expression (parser, NULL, false, + false); + if (expr == error_mark_node) + goto cleanup_error; + + mark_exp_read (expr); + ops[idx] = expr; + + if (kind == OMP_CLAUSE_GANG + && cp_lexer_next_token_is (lexer, CPP_COMMA)) + { + cp_lexer_consume_token (lexer); + continue; + } + break; + } + while (1); + + if (!cp_parser_require (parser, CPP_CLOSE_PAREN, RT_CLOSE_PAREN)) + goto cleanup_error; + } + + check_no_duplicate_clause (list, kind, str, loc); + + c = build_omp_clause (loc, kind); + + if (ops[1]) + OMP_CLAUSE_OPERAND (c, 1) = ops[1]; + + OMP_CLAUSE_OPERAND (c, 0) = ops[0]; + OMP_CLAUSE_CHAIN (c) = list; + + return c; + + cleanup_error: + cp_parser_skip_to_closing_parenthesis (parser, false, false, true); + return list; +} + /* OpenACC: vector_length ( expression ) */ @@ -31306,6 +31456,11 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, clauses = cp_parser_oacc_clause_async (parser, clauses); c_name = "async"; break; + case PRAGMA_OACC_CLAUSE_AUTO: + clauses = cp_parser_oacc_simple_clause (parser, OMP_CLAUSE_AUTO, + clauses, here); + c_name = "auto"; + break; case PRAGMA_OACC_CLAUSE_COLLAPSE: clauses = cp_parser_omp_clause_collapse (parser, clauses, here); c_name = "collapse"; @@ -31338,6 +31493,11 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, clauses = cp_parser_oacc_data_clause_deviceptr (parser, clauses); c_name = "deviceptr"; break; + case PRAGMA_OACC_CLAUSE_GANG: + c_name = "gang"; + clauses = cp_parser_oacc_shape_clause (parser, OMP_CLAUSE_GANG, + c_name, clauses); + break; case PRAGMA_OACC_CLAUSE_HOST: clauses = cp_parser_oacc_data_clause (parser, c_kind, clauses); c_name = "host"; @@ -31382,6 +31542,16 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, clauses = cp_parser_oacc_data_clause (parser, c_kind, clauses); c_name = "self"; break; + case PRAGMA_OACC_CLAUSE_SEQ: + clauses = cp_parser_oacc_simple_clause (parser, OMP_CLAUSE_SEQ, + clauses, here); + c_name = "seq"; + break; + case PRAGMA_OACC_CLAUSE_VECTOR: + c_name = "vector"; + clauses = cp_parser_oacc_shape_clause (parser, OMP_CLAUSE_VECTOR, + c_name, clauses); + break; case PRAGMA_OACC_CLAUSE_VECTOR_LENGTH: clauses = cp_parser_oacc_clause_vector_length (parser, clauses); c_name = "vector_length"; @@ -31390,6 +31560,11 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask, clauses = cp_parser_oacc_clause_wait (parser, clauses); c_name = "wait"; break; + case PRAGMA_OACC_CLAUSE_WORKER: + c_name = "worker"; + clauses = cp_parser_oacc_shape_clause (parser, OMP_CLAUSE_WORKER, + c_name, clauses); + break; default: cp_parser_error (parser, "expected %<#pragma acc%> clause"); goto saw_error; @@ -34339,6 +34514,11 @@ cp_parser_oacc_kernels (cp_parser *parser, cp_token *pragma_tok) #define OACC_LOOP_CLAUSE_MASK \ ( (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_COLLAPSE) \ + | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_GANG) \ + | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_VECTOR) \ + | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_WORKER) \ + | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_AUTO) \ + | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_SEQ) \ | (OMP_CLAUSE_MASK_1 << PRAGMA_OACC_CLAUSE_REDUCTION)) static tree diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 11315d9..2abc73d 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -5965,14 +5965,76 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd) OMP_CLAUSE_FINAL_EXPR (c) = t; break; + case OMP_CLAUSE_GANG: + /* Operand 1 is the gang static: argument. */ + t = OMP_CLAUSE_OPERAND (c, 1); + if (t != NULL_TREE) + { + if (t == error_mark_node) + remove = true; + else if (!type_dependent_expression_p (t) + && !INTEGRAL_TYPE_P (TREE_TYPE (t))) + { + error ("% static expression must be integral"); + remove = true; + } + else + { + t = mark_rvalue_use (t); + if (!processing_template_decl) + { + t = maybe_constant_value (t); + if (TREE_CODE (t) == INTEGER_CST + && tree_int_cst_sgn (t) != 1 + && t != integer_minus_one_node) + { + warning_at (OMP_CLAUSE_LOCATION (c), 0, + "% static value must be" + "positive"); + t = integer_one_node; + } + } + t = fold_build_cleanup_point_expr (TREE_TYPE (t), t); + } + OMP_CLAUSE_OPERAND (c, 1) = t; + } + /* Check operand 0, the num argument. */ + + case OMP_CLAUSE_WORKER: + case OMP_CLAUSE_VECTOR: + if (OMP_CLAUSE_OPERAND (c, 0) == NULL_TREE) + break; + + case OMP_CLAUSE_NUM_TASKS: + case OMP_CLAUSE_NUM_TEAMS: case OMP_CLAUSE_NUM_THREADS: - t = OMP_CLAUSE_NUM_THREADS_EXPR (c); + case OMP_CLAUSE_NUM_GANGS: + case OMP_CLAUSE_NUM_WORKERS: + case OMP_CLAUSE_VECTOR_LENGTH: + t = OMP_CLAUSE_OPERAND (c, 0); if (t == error_mark_node) remove = true; else if (!type_dependent_expression_p (t) && !INTEGRAL_TYPE_P (TREE_TYPE (t))) { - error ("num_threads expression must be integral"); + switch (OMP_CLAUSE_CODE (c)) + { + case OMP_CLAUSE_GANG: + error_at (OMP_CLAUSE_LOCATION (c), + "% num expression must be integral"); break; + case OMP_CLAUSE_VECTOR: + error_at (OMP_CLAUSE_LOCATION (c), + "% length expression must be integral"); + break; + case OMP_CLAUSE_WORKER: + error_at (OMP_CLAUSE_LOCATION (c), + "% num expression must be integral"); + break; + default: + error_at (OMP_CLAUSE_LOCATION (c), + "%qs expression must be integral", + omp_clause_code_name[OMP_CLAUSE_CODE (c)]); + } remove = true; } else @@ -5984,13 +6046,33 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd) if (TREE_CODE (t) == INTEGER_CST && tree_int_cst_sgn (t) != 1) { - warning_at (OMP_CLAUSE_LOCATION (c), 0, - "% value must be positive"); + switch (OMP_CLAUSE_CODE (c)) + { + case OMP_CLAUSE_GANG: + warning_at (OMP_CLAUSE_LOCATION (c), 0, + "% num value must be positive"); + break; + case OMP_CLAUSE_VECTOR: + warning_at (OMP_CLAUSE_LOCATION (c), 0, + "% length value must be" + "positive"); + break; + case OMP_CLAUSE_WORKER: + warning_at (OMP_CLAUSE_LOCATION (c), 0, + "% num value must be" + "positive"); + break; + default: + warning_at (OMP_CLAUSE_LOCATION (c), 0, + "%qs value must be positive", + omp_clause_code_name + [OMP_CLAUSE_CODE (c)]); + } t = integer_one_node; } t = fold_build_cleanup_point_expr (TREE_TYPE (t), t); } - OMP_CLAUSE_NUM_THREADS_EXPR (c) = t; + OMP_CLAUSE_OPERAND (c, 0) = t; } break; @@ -6062,35 +6144,6 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd) } break; - case OMP_CLAUSE_NUM_TEAMS: - t = OMP_CLAUSE_NUM_TEAMS_EXPR (c); - if (t == error_mark_node) - remove = true; - else if (!type_dependent_expression_p (t) - && !INTEGRAL_TYPE_P (TREE_TYPE (t))) - { - error ("% expression must be integral"); - remove = true; - } - else - { - t = mark_rvalue_use (t); - if (!processing_template_decl) - { - t = maybe_constant_value (t); - if (TREE_CODE (t) == INTEGER_CST - && tree_int_cst_sgn (t) != 1) - { - warning_at (OMP_CLAUSE_LOCATION (c), 0, - "% value must be positive"); - t = integer_one_node; - } - t = fold_build_cleanup_point_expr (TREE_TYPE (t), t); - } - OMP_CLAUSE_NUM_TEAMS_EXPR (c) = t; - } - break; - case OMP_CLAUSE_ASYNC: t = OMP_CLAUSE_ASYNC_EXPR (c); if (t == error_mark_node) @@ -6110,16 +6163,6 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd) } break; - case OMP_CLAUSE_VECTOR_LENGTH: - t = OMP_CLAUSE_VECTOR_LENGTH_EXPR (c); - t = maybe_convert_cond (t); - if (t == error_mark_node) - remove = true; - else if (!processing_template_decl) - t = fold_build_cleanup_point_expr (TREE_TYPE (t), t); - OMP_CLAUSE_VECTOR_LENGTH_EXPR (c) = t; - break; - case OMP_CLAUSE_WAIT: t = OMP_CLAUSE_WAIT_EXPR (c); if (t == error_mark_node) @@ -6547,35 +6590,6 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd) } goto check_dup_generic; - case OMP_CLAUSE_NUM_TASKS: - t = OMP_CLAUSE_NUM_TASKS_EXPR (c); - if (t == error_mark_node) - remove = true; - else if (!type_dependent_expression_p (t) - && !INTEGRAL_TYPE_P (TREE_TYPE (t))) - { - error ("% expression must be integral"); - remove = true; - } - else - { - t = mark_rvalue_use (t); - if (!processing_template_decl) - { - t = maybe_constant_value (t); - if (TREE_CODE (t) == INTEGER_CST - && tree_int_cst_sgn (t) != 1) - { - warning_at (OMP_CLAUSE_LOCATION (c), 0, - "% value must be positive"); - t = integer_one_node; - } - t = fold_build_cleanup_point_expr (TREE_TYPE (t), t); - } - OMP_CLAUSE_NUM_TASKS_EXPR (c) = t; - } - break; - case OMP_CLAUSE_GRAINSIZE: t = OMP_CLAUSE_GRAINSIZE_EXPR (c); if (t == error_mark_node) @@ -6694,6 +6708,8 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd) case OMP_CLAUSE_SIMD: case OMP_CLAUSE_DEFAULTMAP: case OMP_CLAUSE__CILK_FOR_COUNT_: + case OMP_CLAUSE_AUTO: + case OMP_CLAUSE_SEQ: break; case OMP_CLAUSE_INBRANCH: diff --git a/gcc/testsuite/g++.dg/gomp/pr33372-1.C b/gcc/testsuite/g++.dg/gomp/pr33372-1.C index 62900bf..e9da259 100644 --- a/gcc/testsuite/g++.dg/gomp/pr33372-1.C +++ b/gcc/testsuite/g++.dg/gomp/pr33372-1.C @@ -6,7 +6,7 @@ template void f () { extern T n (); -#pragma omp parallel num_threads(n) // { dg-error "num_threads expression must be integral" } +#pragma omp parallel num_threads(n) // { dg-error "'num_threads' expression must be integral" } ; #pragma omp parallel for schedule(static, n) for (int i = 0; i < 10; i++) // { dg-error "chunk size expression must be integral" } diff --git a/gcc/testsuite/g++.dg/gomp/pr33372-3.C b/gcc/testsuite/g++.dg/gomp/pr33372-3.C index 8220f3c..f0a1910 100644 --- a/gcc/testsuite/g++.dg/gomp/pr33372-3.C +++ b/gcc/testsuite/g++.dg/gomp/pr33372-3.C @@ -6,7 +6,7 @@ template void f () { T n = 6; -#pragma omp parallel num_threads(n) // { dg-error "num_threads expression must be integral" } +#pragma omp parallel num_threads(n) // { dg-error "'num_threads' expression must be integral" } ; #pragma omp parallel for schedule(static, n) for (int i = 0; i < 10; i++) // { dg-error "chunk size expression must be integral" }