public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jellby at yahoo dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/98787] New: Aliasing not detected with array elements or some intents
Date: Fri, 22 Jan 2021 08:44:14 +0000	[thread overview]
Message-ID: <bug-98787-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98787

            Bug ID: 98787
           Summary: Aliasing not detected with array elements or some
                    intents
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jellby at yahoo dot com
  Target Milestone: ---

With -Waliasing (or -Wall), passing the same array as two dummy arguments with
"intent(in)" and "intent(out)" is detected and warned about, but not when only
an array element (which may be the whole array with assumed size) is passed, or
when "intent(inout)" is used.

!==================================
program main
implicit none
real :: x(100)
integer :: i

do i=1,size(x)
  x(i) = i
end do

! no warning for this:
call sub(size(x),x(1),x(1))
! warning for this:
call sub(size(x),x,x)

contains

subroutine sub(n,a,b)
implicit none
integer, intent(in) :: n
! no warning if one of these is inout:
real, intent(in) :: a(n)
real, intent(out) :: b(n)

b(:) = a(:)

end subroutine sub

end program main
!==================================

             reply	other threads:[~2021-01-22  8:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-22  8:44 jellby at yahoo dot com [this message]
2021-01-23 21:54 ` [Bug fortran/98787] " dominiq at lps dot ens.fr

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=bug-98787-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).