public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias@codesourcery.com>
To: Thomas Schwinge <thomas@codesourcery.com>, <fortran@gcc.gnu.org>,
	Jakub Jelinek <jakub@redhat.com>
Subject: Re: OpenACC 'acc_is_present' on un-allocated array: '-Wuninitialized' diagnostics
Date: Tue, 25 Oct 2022 13:55:59 +0200	[thread overview]
Message-ID: <0db215d1-7b9a-8a4e-31e7-80aa2c345e60@codesourcery.com> (raw)
In-Reply-To: <87h6ztneqn.fsf@euler.schwinge.homeip.net>

Hi Thomas,

On 24.10.22 22:33, Thomas Schwinge wrote:
> Given the following reduced code, from a bigger test case that I'm
> currently writing:
>        integer, allocatable :: ar(:,:,:)
>        logical :: l
>        l = acc_is_present (ar)
> ...
>
>      360     function acc_is_present_array_h (a)
>      361       logical acc_is_present_array_h
>      362       type (*), dimension (..), contiguous :: a
>      363     end function

The function semantics for that function, provided by the interface, is
that that the array "a" has to exist, i.e. it has to be allocated.
Addionally, the 'contiguous' attribute also requires that the argument
is made contiguous. (Well, in this case it is a whole allocatable array
– those are known to be contiguous).

You could try to add an 'optional' attribute to 'a' – and check whether
it then works; I think it should, but I have now my lunch break and
cannot check.

optional = absent argument or unallocated allocatable or unassociated
pointer.

Tobias

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

      reply	other threads:[~2022-10-25 11:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-24 20:33 Thomas Schwinge
2022-10-25 11:55 ` Tobias Burnus [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0db215d1-7b9a-8a4e-31e7-80aa2c345e60@codesourcery.com \
    --to=tobias@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=thomas@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).