public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/52351] New: Wrong bounds when passing an array section to an intent-in pointer dummy
@ 2012-02-23 10:49 burnus at gcc dot gnu.org
  2012-02-23 11:26 ` [Bug fortran/52351] " burnus at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-02-23 10:49 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52351
           Summary: Wrong bounds when passing an array section to an
                    intent-in pointer dummy
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


The following program should print:
           3           6
           1           4
but it wrongly prints
           3           6
           3           6


The program uses the Fortran 2008 feature that one can pass a nonpointer to an
intent(in) pointer argument.


>From the standard:

"12.5.2.7 Pointer dummy variables"
"If the dummy argument does not have the INTENT (IN), the actual argument shall
be a pointer. Otherwise, the actual argument shall be a pointer or a valid
target for the dummy pointer in a pointer assignment statement. If the actual
argument is not a pointer, the dummy pointer becomes pointer associated with
the actual argument."

"16.5.2 Pointer association"
"If the pointer has deferred type parameters or shape, their values are assumed
from the target."


As lbound(a(:)) == 1 (always) and lbound(a) == 3 (in this example), the
respective result should be obtained for lbound(x).



integer, allocatable, target :: A(:)
allocate(A(3:6))

call sub (a)
call sub (a(:))

contains

  subroutine sub(x)
    integer, pointer, intent(in) :: x(:)
    print *, lbound(x), ubound(x)
  end subroutine sub
end


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

end of thread, other threads:[~2020-06-11 14:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-23 10:49 [Bug fortran/52351] New: Wrong bounds when passing an array section to an intent-in pointer dummy burnus at gcc dot gnu.org
2012-02-23 11:26 ` [Bug fortran/52351] " burnus at gcc dot gnu.org
2012-02-23 22:54 ` burnus at gcc dot gnu.org
2013-06-20 18:10 ` dominiq at lps dot ens.fr
2020-06-11 12:21 ` cvs-commit at gcc dot gnu.org
2020-06-11 14:11 ` tkoenig at gcc dot gnu.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).