From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64503 invoked by alias); 3 Dec 2015 08:59:31 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 64484 invoked by uid 89); 3 Dec 2015 08:59:30 -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_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; Thu, 03 Dec 2015 08:59:29 +0000 Received: from svr-orw-fem-03.mgc.mentorg.com ([147.34.97.39]) by relay1.mentorg.com with esmtp id 1a4Pja-0002sI-Ad from Thomas_Schwinge@mentor.com ; Thu, 03 Dec 2015 00:59:26 -0800 Received: from tftp-cs (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.3.224.2; Thu, 3 Dec 2015 00:59:25 -0800 Received: by tftp-cs (Postfix, from userid 49978) id 12BCBC2319; Thu, 3 Dec 2015 00:59:25 -0800 (PST) From: Thomas Schwinge To: Chung-Lin Tang , Jakub Jelinek CC: Jason Merrill , "Joseph S. Myers" , gcc-patches Subject: Re: [PATCH, C++] Wrap OpenACC wait in EXPR_STMT In-Reply-To: <87io4flxt8.fsf@kepler.schwinge.homeip.net> References: <56531154.9080606@codesourcery.com> <87io4flxt8.fsf@kepler.schwinge.homeip.net> User-Agent: Notmuch/0.9-125-g4686d11 (http://notmuchmail.org) Emacs/24.5.1 (i586-pc-linux-gnu) Date: Thu, 03 Dec 2015 08:59:00 -0000 Message-ID: <87bna7lxg9.fsf@kepler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-SW-Source: 2015-12/txt/msg00397.txt.bz2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 2790 Hi! On Thu, 03 Dec 2015 09:51:31 +0100, I wrote: > On Mon, 23 Nov 2015 21:15:00 +0800, Chung-Lin Tang wrote: > > The OpenACC wait directive is represented as a call to the runtime > > function "GOACC_wait" instead of a tree code. I am seeing when > > '#pragma acc wait' is using inside a template function, the CALL_EXPR > > to GOACC_wait is being silently ignored/removed during tsubst_expr(). >=20 > Uh. >=20 > > I think the correct way to organize this is that the call should be ins= ide > > an EXPR_STMT, so here's a patch to do that; basically remove the > > add_stmt() call from the shared c_finish_oacc_wait() code, and add > > add_stmt()/finish_expr_stmt() in the corresponding C/C++ parts. > >=20 > > Tested with no regressions on trunk, okay to commit? >=20 > > --- c-family/c-omp.c (revision 230703) > > +++ c-family/c-omp.c (working copy) > > @@ -63,7 +63,6 @@ c_finish_oacc_wait (location_t loc, tree parms, tr > > } > >=20=20 > > stmt =3D build_call_expr_loc_vec (loc, stmt, args); > > - add_stmt (stmt); > >=20=20 > > vec_free (args); > |=20=20 > | return stmt; > | } >=20 > I see in gcc/c/c-omp.c that several other c_finish_omp_* functions that > build builtin calls instead of tree nodes, do similar things like > c_finish_oacc_wait; I'd like to understand why it's -- presumably -- not > a problem for these: c_finish_omp_barrier, c_finish_omp_taskwait, > c_finish_omp_taskyield, c_finish_omp_flush? (Jakub?) Oh wait, it looks like the C++ front end is not actually using the functions defined in the C/C++-shared gcc/c-family/c-omp.c, but has its own implementations in gcc/cp/semantics.c, without "c_" prefixes? In addition to finish_expr_stmt calls, I see it's also using finish_call_expr instead of build_call_expr_loc/build_call_expr_loc_vec. So I guess we'll want to model this the same way for OpenACC support functions, and then (later) we should clean this up, to move the C-specific code from gcc/c-family/c-omp.c into the C front end? (Jakub?) > > --- c/c-parser.c (revision 230703) > > +++ c/c-parser.c (working copy) > > @@ -13886,6 +13886,7 @@ c_parser_oacc_wait (location_t loc, c_parser *p= ars > > strcpy (p_name, " wait"); > > clauses =3D c_parser_oacc_all_clauses (parser, OACC_WAIT_CLAUSE_MASK= , p_name); > > stmt =3D c_finish_oacc_wait (loc, list, clauses); > > + add_stmt (stmt); > >=20=20 > > return stmt; > > } > > --- cp/parser.c (revision 230703) > > +++ cp/parser.c (working copy) > > @@ -34930,6 +34930,7 @@ cp_parser_oacc_wait (cp_parser *parser, cp_toke= n * > > "#pragma acc wait", pragma_tok); > >=20=20 > > stmt =3D c_finish_oacc_wait (loc, list, clauses); > > + stmt =3D finish_expr_stmt (stmt); > >=20=20 > > return stmt; > > } Gr=C3=BC=C3=9Fe Thomas --=-=-= Content-Type: application/pgp-signature; name="signature.asc" Content-length: 472 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJWYARmAAoJEK3/DN1sMFFtuxAH/2g++eJCRSC6q2SNcGnqzvK8 a12Ea5lLSZNgpDrUJBj0rFILVyfKOuuTFjAQSUR8LBApSYpKYKxQ0xLhbSgDAHgA 57zgmhCDiOoOIm3IP+MFyIG81Di0ITIOhakndA/ITps+DxrolTDFez/dTRDU4oIJ FvQr3HyUh2DrSqZnUPOL8NxbJO5JPoWYARI0bhfBPzJxEnGso93hYw502YgEjHt7 uW2CXGmL4CX3i6A5VQa6c5t4EhXySsHk+21h8aNenPlxcldf1trd7p53p4ShjCVg f1RT/cuFDliOT+M+PDOSVayorpyaMNY/cujThQP7j0oP87fExwlKOfumADmFpEo= =Y19t -----END PGP SIGNATURE----- --=-=-=--