public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/45019]  New: Aliasing of TARGET dummy argument not detected correctly
@ 2010-07-21 15:41 domob at gcc dot gnu dot org
  2010-07-21 15:57 ` [Bug fortran/45019] " burnus at gcc dot gnu dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: domob at gcc dot gnu dot org @ 2010-07-21 15:41 UTC (permalink / raw)
  To: gcc-bugs

The following program:

MODULE m
  IMPLICIT NONE
  INTEGER, TARGET :: arr(3)

CONTAINS

  SUBROUTINE foobar (arg)
    INTEGER, TARGET :: arg(:)

    arr(2:3) = arg(1:2)
  END SUBROUTINE foobar

END MODULE m

PROGRAM main
  USE :: m
  IMPLICIT NONE

  arr = (/ 1, 2, 3 /)
  CALL foobar (arr)
  PRINT *, arr
END PROGRAM main

does not create a temporary array inside foobar and prints "1 1 1", while I
think it should print "1 1 2".

In the Fortran 2008 standard, 12.5.2.13, 3b):

(3) Action that affects the value of the entity or any subobject of it shall be
taken only through the dummy argument unless
a) ... or
b) the dummy argument has the TARGET attribute, the dummy argument does not
have INTENT(IN), the dummy argument is a scalar object or an assumed-shape
array without the CONTIGUOUS attribute, and the actual argument is a target
other than an array section with a vector subscript.

It seems to me that this allows the code above.


-- 
           Summary: Aliasing of TARGET dummy argument not detected correctly
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: domob at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45019


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2010-09-04 19:21 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-21 15:41 [Bug fortran/45019] New: Aliasing of TARGET dummy argument not detected correctly domob at gcc dot gnu dot org
2010-07-21 15:57 ` [Bug fortran/45019] " burnus at gcc dot gnu dot org
2010-07-21 16:32 ` burnus at gcc dot gnu dot org
2010-07-21 16:44 ` burnus at gcc dot gnu dot org
2010-07-21 16:58 ` burnus at gcc dot gnu dot org
2010-07-21 18:43 ` burnus at gcc dot gnu dot org
2010-07-21 21:37 ` burnus at gcc dot gnu dot org
2010-07-22  6:45 ` burnus at gcc dot gnu dot org
2010-07-22  8:40 ` burnus at gcc dot gnu dot org
2010-07-22 10:01 ` paul dot richard dot thomas at gmail dot com
2010-07-22 11:35 ` burnus at gcc dot gnu dot org
2010-07-23  8:40 ` burnus at gcc dot gnu dot org
2010-07-23  9:53 ` burnus at gcc dot gnu dot org
2010-09-04 19:21 ` burnus at gcc dot gnu dot org
2010-09-04 19:21 ` burnus at gcc dot gnu dot org

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).