From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id C15BD3858CD1; Wed, 20 Dec 2023 14:31:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C15BD3858CD1 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C15BD3858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=68.232.137.252 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703082693; cv=none; b=MEji/d8FZgHl9E/IdC0ULpIKZrLI8Dg00LimDv7XcJZECe+0MxlkKodgzz7X3b0sriQM/tDuM0z2sh0YVoSbyc6QH8aEK03SfPT9FRMS6RftuQizmheFH8aUNxOJ3qOvTgiZZl4ygGqiYKZO3WgW85gKYvywANM7XA7hoSTXx+Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703082693; c=relaxed/simple; bh=D+N4SYU/2IJ6HZqfb3V0Fp1doH4H2dZOAaC+4fuGil4=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=wt8EP+TZKicxUYo1xQ3JNc2uUg76e9DL5h/G21bopwpQqeNB7mN8Dtjxhza+dKGDiFp1JfJlOh120At+aDGKiu9A39bpxWFkJNeOEVKzgnW1fKd/j71Y++r8+QndU3oVI6foxsKQbvt7LP2jKDKsprVPdeKKUBCmuVujyZWKF9U= ARC-Authentication-Results: i=1; server2.sourceware.org X-CSE-ConnectionGUID: jYRnzuBUQy68lOk6zoYQKA== X-CSE-MsgGUID: 66IGAvULRPGjeUtTCnUy7w== X-IronPort-AV: E=Sophos;i="6.04,291,1695715200"; d="scan'208";a="25811401" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 20 Dec 2023 06:31:21 -0800 IronPort-SDR: Wm06AxY9v4TwQQTlh4PEETQSl+JBw+UdUx6BCe0KqHTg47NWcY02KnsXzla4BGS+eX8XcID9W7 YTB57Ny8GnyKXnX487Jy3dotaKJRgxDhoq/o+5fURovVv/YbJ/q1R2rnmrYwkb9TzE6F2WG2Vf 46j5Bs6TQxuZ0KYTsZOUXKLn9LWe5IC+G3yYSU1RX8bcE3D8dfiAHS8JyEZ0yreTtCxFDzCoBT Kxc4S/slcFYSr3ZOj4LXdTWMDw0k/8gS/R0PTobcF93bc33c5vO5L78dUmMnoL0o6IhSclD7Bl HdY= Message-ID: <9a497499-31d7-4bb2-afdd-815966b49406@codesourcery.com> Date: Wed, 20 Dec 2023 15:31:15 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/8] OpenMP: lvalue parsing for map/to/from clauses (C++) Content-Language: en-US To: Julian Brown , CC: , References: From: Tobias Burnus In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-13.mgc.mentorg.com (139.181.222.13) To svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12) X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,KAM_SHORT,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 05.09.23 21:28, Julian Brown wrote: > This patch supports "lvalue" parsing (or "locator list item type" parsing= ) > for several OpenMP clause types for C++, as required for OpenMP 5.0 > and above. It is based on the version committed to the og13 branch, > posted here: > > https://gcc.gnu.org/pipermail/gcc-patches/2023-June/623354.html > > which in turn was based on the last version posted upstream: > > https://gcc.gnu.org/pipermail/gcc-patches/2022-December/609040.html > > This version has mostly just been rebased. I had a first pass at the patch and didn't spot anything (C++ code wise); I have some build/rebase issues and one .texi comment that is trivial and could also be handled together with the 2/8 patch (adding C support). * * * Another rebase is required because of: 1 out of 22 hunks FAILED -- saving rejects to file gcc/cp/parser.cc.rej 1 out of 4 hunks FAILED -- saving rejects to file gcc/cp/pt.cc.rej but those patch-apply fails look trivial to fix. And during build, I see: gcc/cp/decl2.cc:643:20: error: =E2=80=98build_non_dependent_expr=E2=80=99 w= as not declared in this scope; did you mean =E2=80=98fold_non_dependent_exp= r=E2=80=99? For details, see the two commits: cd0e05b7ac3 c++: remove NON_DEPENDENT_EXPR, part 2 dad311874ac c++: remove NON_DEPENDENT_EXPR, part 1 * * * When commenting those, even more build issues show up: ../../repos/gcc/gcc/cp/pt.cc:20493:20: error: =E2=80=98tsubst_copy=E2=80=99= was not declared in this scope; did you mean =E2=80=98tsubst_scope=E2=80= =99? 20493 | tree op0 =3D tsubst_copy (TREE_OPERAND (t, 0), args, compla= in, in_decl); | ^~~~~~~~~~~ | tsubst_scope In file included from ../../repos/gcc/gcc/cp/pt.cc:31: ../../repos/gcc/gcc/cp/pt.cc: In function =E2=80=98bool value_dependent_exp= ression_p(tree)=E2=80=99: ../../repos/gcc/gcc/cp/pt.cc:28009:41: error: =E2=80=98t=E2=80=99 was not d= eclared in this scope; did you mean =E2=80=98tm=E2=80=99? 28009 | tree op0 =3D RECUR (TREE_OPERAND (t, 0)); | ^ ../../repos/gcc/gcc/system.h:1178:61: note: in definition of macro =E2=80= =98CONST_CAST2=E2=80=99 1178 | #define CONST_CAST2(TOTYPE,FROMTYPE,X) (const_cast (X)) | ^ ../../repos/gcc/gcc/tree.h:1285:31: note: in expansion of macro =E2=80=98TR= EE_OPERAND_CHECK=E2=80=99 1285 | #define TREE_OPERAND(NODE, I) TREE_OPERAND_CHECK (NODE, I) | ^~~~~~~~~~~~~~~~~~ ../../repos/gcc/gcc/cp/pt.cc:28009:27: note: in expansion of macro =E2=80= =98TREE_OPERAND=E2=80=99 28009 | tree op0 =3D RECUR (TREE_OPERAND (t, 0)); | ^~~~~~~~~~~~ ../../repos/gcc/gcc/cp/pt.cc:28009:20: error: =E2=80=98RECUR=E2=80=99 was n= ot declared in this scope 28009 | tree op0 =3D RECUR (TREE_OPERAND (t, 0)); | ^~~~~ ../../repos/gcc/gcc/cp/pt.cc:28012:11: error: =E2=80=98RETURN=E2=80=99 was = not declared in this scope 28012 | RETURN (error_mark_node); | ^~~~~~ * * * BTW: There is OpenMP specification Issue 2618 which is about code like "map= (*p =3D 10)" with the intent to disallow it. That's in line with the current code which prints a 'sorry' for those. * * * libgomp.texi contains: @item C/C++'s lvalue expressions in @code{to}, @code{from} and @code{map} clauses @tab N @tab I think this can be set to 'P' + 'Only C++'; I think except for questionabl= e code like '*p =3D 10' the support is complete, isn't it? If no, 'Initial support for C++, only' c= ould be a comment. Alternatively, we can fold it into the next patch (which adds C support). * * * > 2023-09-05 Julian Brown > > gcc/c-family/ > * c-common.h (c_omp_address_inspector): Remove static from get_orig= in > and maybe_unconvert_ref methods. > * c-omp.cc (c_omp_split_clauses): Support OMP_ARRAY_SECTION. > (c_omp_address_inspector::map_supported_p): Handle OMP_ARRAY_SECTIO= N. > (c_omp_address_inspector::get_origin): Avoid dereferencing possibly > NULL type when processing template decls. > (c_omp_address_inspector::maybe_unconvert_ref): Likewise. > > gcc/cp/ > * constexpr.cc (potential_consant_expression_1): Handle > OMP_ARRAY_SECTION. > * cp-tree.h (grok_omp_array_section, build_omp_array_section): Add > prototypes. > * decl2.cc (grok_omp_array_section): New function. > * error.cc (dump_expr): Handle OMP_ARRAY_SECTION. > * parser.cc (cp_parser_new): Initialize parser->omp_array_section_p= . > (cp_parser_statement_expr): Disallow array sections. > (cp_parser_postfix_open_square_expression): Support OMP_ARRAY_SECTI= ON > parsing. > (cp_parser_parenthesized_expression_list, cp_parser_lambda_expressi= on, > cp_parser_braced_list): Disallow array sections. > (cp_parser_omp_var_list_no_open): Remove ALLOW_DEREF parameter, add > MAP_LVALUE in its place. Support generalised lvalue parsing for > OpenMP map, to and from clauses. Use OMP_ARRAY_SECTION > code instead of TREE_LIST to represent OpenMP array sections. > (cp_parser_omp_var_list): Remove ALLOW_DEREF parameter, add MAP_LVA= LUE. > Pass to cp_parser_omp_var_list_no_open. > (cp_parser_oacc_data_clause): Update call to cp_parser_omp_var_list= . > (cp_parser_omp_clause_map): Add sk_omp scope around > cp_parser_omp_var_list_no_open call. > * parser.h (cp_parser): Add omp_array_section_p field. > * pt.cc (tsubst, tsubst_copy, tsubst_omp_clause_decl, > tsubst_copy_and_build): Add OMP_ARRAY_SECTION support. > * semantics.cc (handle_omp_array_sections_1, handle_omp_array_secti= ons, > cp_oacc_check_attachments, finish_omp_clauses): Use OMP_ARRAY_SECTI= ON > instead of TREE_LIST where appropriate. Handle more types of map > expression. > * typeck.cc (build_omp_array_section): New function. > > gcc/ > * gimplify.cc (gimplify_expr): Ensure OMP_ARRAY_SECTION has been > processed out before gimplification. > * tree-pretty-print.cc (dump_generic_node): Support OMP_ARRAY_SECTI= ON. > * tree.def (OMP_ARRAY_SECTION): New tree code. > > gcc/testsuite/ > * c-c++-common/gomp/map-6.c: Update expected output. > * g++.dg/gomp/array-section-1.C: New test. > * g++.dg/gomp/array-section-2.C: New test. > * g++.dg/gomp/bad-array-section-1.C: New test. > * g++.dg/gomp/bad-array-section-2.C: New test. > * g++.dg/gomp/bad-array-section-3.C: New test. > * g++.dg/gomp/bad-array-section-4.C: New test. > * g++.dg/gomp/bad-array-section-5.C: New test. > * g++.dg/gomp/bad-array-section-6.C: New test. > * g++.dg/gomp/bad-array-section-7.C: New test. > * g++.dg/gomp/bad-array-section-8.C: New test. > * g++.dg/gomp/bad-array-section-9.C: New test. > * g++.dg/gomp/bad-array-section-10.C: New test. > * g++.dg/gomp/bad-array-section-11.C: New test. > * g++.dg/gomp/has_device_addr-non-lvalue-1.C: New test. > * g++.dg/gomp/pr67522.C: Update expected output. > * g++.dg/gomp/ind-base-3.C: New test. > * g++.dg/gomp/map-assignment-1.C: New test. > * g++.dg/gomp/map-inc-1.C: New test. > * g++.dg/gomp/map-lvalue-ref-1.C: New test. > * g++.dg/gomp/map-ptrmem-1.C: New test. > * g++.dg/gomp/map-ptrmem-2.C: New test. > * g++.dg/gomp/map-static-cast-lvalue-1.C: New test. > * g++.dg/gomp/map-ternary-1.C: New test. > * g++.dg/gomp/member-array-2.C: New test. > > libgomp/ > * testsuite/libgomp.c++/baseptrs-4.C: Remove commented-out cases th= at > now work. > * testsuite/libgomp.c++/baseptrs-6.C: New test. > * testsuite/libgomp.c++/ind-base-1.C: New test. > * testsuite/libgomp.c++/ind-base-2.C: New test. > * testsuite/libgomp.c++/lvalue-tofrom-1.C: New test. > * testsuite/libgomp.c++/lvalue-tofrom-2.C: New test. > * testsuite/libgomp.c++/map-comma-1.C: New test. > * testsuite/libgomp.c++/map-rvalue-ref-1.C: New test. > * testsuite/libgomp.c++/struct-ref-1.C: New test. > * testsuite/libgomp.c-c++-common/array-field-1.c: New test. > * testsuite/libgomp.c-c++-common/array-of-struct-1.c: New test. > * testsuite/libgomp.c-c++-common/array-of-struct-2.c: New test. ... Tobias ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955