public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jorge D'Elia <jdelia@intec.unl.edu.ar>
To: Gfortran List <fortran@gcc.gnu.org>
Subject: A question about coarrays and -Warray-temporaries
Date: Sun, 31 Jan 2021 12:51:03 -0300 (ART)	[thread overview]
Message-ID: <121178681.597.1612108263047.JavaMail.zimbra@intec.unl.edu.ar> (raw)

Hi all,

I have a question with -Warray-temporaries in the test below. 

With the AA coarray that warning appears in the first loop (on its local part), 
but not with the BB array with the same task, i.e.


$ gfortran --version
GNU Fortran (GCC) 11.0.0 20210125 (experimental)
Copyright (C) 2021 Free Software Foundation, Inc.

$ gfortran -march=native -mtune=native -Ofast -fcheck=all -fcoarray=single -std=f2018 -Wall -Wextra -Warray-temporaries -o test.exe test.f90 
test.f90:37:19:

   37 |     AA (k1:nn,j) = AA (k1:nn,j) - UU (k1:nn) * AA (k,j)
      |                   1
Warning: Creating array temporary at (1) [-Warray-temporaries]


Why this difference in behavior? Is it ok? 

Thanks in advance for some clarification. 

Greetings. 
Jorge

program test
  implicit none
  integer, parameter :: iin = kind (1)     
  integer, parameter :: idp = kind (1.0d0) 
  real    (kind=idp), allocatable :: AA (:,:)[:]
  real    (kind=idp), allocatable :: BB (:,:)
  real    (kind=idp), allocatable :: UU (:)
  integer (kind=iin) :: nn, n1, n2
  integer (kind=iin) :: j, k, k1
  !
  nn =  5
  n1 =  1
  n2 = 10
  !
  allocate (AA (1:nn,n1:n2)[*])
  allocate (BB (1:nn,n1:n2))
  allocate (UU (1:nn))
  !
  k  = 1
  k1 = k + 1
  !
  AA = 1.0_idp
  UU = 2.0_idp
  !
  do  j = 1, nn
    AA (k1:nn,j) = AA (k1:nn,j) - UU (k1:nn) * AA (k,j)
  end do
  !
  do  j = 1, nn
    BB (k1:nn,j) = BB (k1:nn,j) - UU (k1:nn) * BB (k,j)
  end do
  !
  deallocate (AA)
  deallocate (BB)
  deallocate (UU)
  !
end program test
--

             reply	other threads:[~2021-01-31 15:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-31 15:51 Jorge D'Elia [this message]
2021-02-01  7:42 ` Thomas Koenig
2021-02-01 10:43   ` Jorge D'Elia
2021-02-01 11:52   ` Tobias Burnus
2021-02-02 11:46     ` [Patch] Fortran: Fix Array dependency with local coarrays [PR98913] (was: Re: A question about coarrays and -Warray-temporaries) Tobias Burnus
2021-02-02 14:32       ` Jorge D'Elia
2021-02-02 14:54       ` Thomas Koenig
2021-02-02 17:15         ` Tobias Burnus
2021-02-09 11:52           ` [Patch] Fortran: Fix coarray handling for gfc_dep_resolver [PR99010] (was: Re: [Patch] Fortran: Fix Array dependency with local coarrays [PR98913] Tobias Burnus
2021-02-13 19:57             ` Tobias Burnus
2021-02-19  9:33             ` *PING**2 " Tobias Burnus
2021-02-19 16:25               ` Jerry DeLisle
2021-03-21 16:18 ` A doubt about lbound and ubound of an array inside a coarray Jorge D'Elia

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=121178681.597.1612108263047.JavaMail.zimbra@intec.unl.edu.ar \
    --to=jdelia@intec.unl.edu.ar \
    --cc=fortran@gcc.gnu.org \
    --cc=jdelia@cimec.unl.edu.ar \
    /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).