From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 91224 invoked by alias); 31 Oct 2019 17:59:02 -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 91208 invoked by uid 89); 31 Oct 2019 17:59:02 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: us-smtp-delivery-1.mimecast.com Received: from us-smtp-2.mimecast.com (HELO us-smtp-delivery-1.mimecast.com) (207.211.31.81) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 31 Oct 2019 17:59:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572544739; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f+HcuSEQOarto48ffhdrCqaW6AbjndswyQWXXlcLFOo=; b=hp+7PqzGmYi5U9WDRQzeb1LQOgntnWQPRiN0iuM3r768PhrNxPQn23ug3QUKOcfMPWq93m KAf3DEBKGeiO4XmSk053cacRPrXCBFoYlQYRrFtwkigPNhDbXPqXc8s7bBVu3niv9bauSg vM+eKiotYwMra0CEXuPDacD3YK1H5lg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-151-KZnfxbBvNEeYcorzloPDAA-1; Thu, 31 Oct 2019 13:58:56 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C2AEB107ACC0; Thu, 31 Oct 2019 17:58:55 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.36.118.135]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6B7655D6D8; Thu, 31 Oct 2019 17:58:55 +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 x9VHwrt3031824; Thu, 31 Oct 2019 18:58:53 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id x9VHwosY031823; Thu, 31 Oct 2019 18:58:50 +0100 Date: Thu, 31 Oct 2019 18:02:00 -0000 From: Jakub Jelinek To: Tobias Burnus Cc: gcc-patches , fortran Subject: Re: [Patch][OpenMP] use_device_addr/use_device_ptr with Fortran allocatable/pointer arrays (= array descriptor) Message-ID: <20191031175850.GP4650@tucnak> Reply-To: Jakub Jelinek References: <7b38dcfe-7510-59f1-f6aa-1735abc340c8@codesourcery.com> <20191030103714.GT4650@tucnak> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-IsSubscribed: yes X-SW-Source: 2019-10/txt/msg02256.txt.bz2 On Thu, Oct 31, 2019 at 06:09:28PM +0100, Tobias Burnus wrote: > --- a/gcc/fortran/trans-openmp.c > +++ b/gcc/fortran/trans-openmp.c > @@ -71,6 +71,33 @@ gfc_omp_is_optional_argument (const_tree decl) > && GFC_DECL_OPTIONAL_ARGUMENT (decl)); > } >=20=20 > + > +/* Returns tree with NULL if it is not an array descriptor and with the = tree to > + access the 'data' component otherwise. With type_only =3D true, it r= eturns the > + TREE_TYPE without creating a new tree. */ > + > +tree > +gfc_omp_array_data (tree decl, bool type_only) > +{ > + tree type =3D TREE_TYPE (decl); > + > + if (TREE_CODE (type) =3D=3D REFERENCE_TYPE || POINTER_TYPE_P (type)) POINTER_TYPE_P is defined as #define POINTER_TYPE_P(TYPE) \ (TREE_CODE (TYPE) =3D=3D POINTER_TYPE || TREE_CODE (TYPE) =3D=3D REFERENC= E_TYPE) so no need for the "TREE_CODE (type) =3D=3D REFERENCE_TYPE || " part. > @@ -12048,11 +12070,50 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, = omp_context *ctx) > case OMP_CLAUSE_USE_DEVICE_ADDR: > case OMP_CLAUSE_IS_DEVICE_PTR: > var =3D OMP_CLAUSE_DECL (c); > + bool is_array_data > + =3D lang_hooks.decls.omp_array_data (var, true) !=3D NULL; As this is inside of switch body at the switch body scope, I'd say it would= be better to: + bool is_array_data; + is_array_data + =3D lang_hooks.decls.omp_array_data (var, true) !=3D NULL; While it will compile now because there are no labels after it, as soon as somebody adds one, it will fail to compile. Ok for trunk with those nits fixed. Jakub