public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/49076] New: ASSOCIATE: Array descriptor passed to explicit-shaped dummy
@ 2011-05-20  8:01 burnus at gcc dot gnu.org
  2011-05-20 22:15 ` [Bug fortran/49076] " burnus at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-05-20  8:01 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: ASSOCIATE: Array descriptor passed to explicit-shaped
                    dummy
           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
                CC: domob@gcc.gnu.org


Reported by Andrew Baldwin at
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/b1ff1e3da48e6b27

The following program prints with gfortran:

            3           4
            3           4
     33275912           0

With ifort 12 - and reportedly with NAG 5.2, it prints:
           3           4
           3           4
           3           4

If one looks at the dump, one sees that in associated the function is called
as:

        print_int (&bar);

That's both the case for the explicit-shape "i(2)" and for an assumed-shape
"i(:)". As "&bar" is the address of the descriptor, it works with assumed-shape
arrays - and fails with assumed-size/explicit-size arrays.


       subroutine print_int (i)
         integer, intent (in) :: i(2)

         print *, i
       end subroutine print_int

       program main
         interface
           subroutine print_int (i)
             integer, intent (in) :: i(2)
           end subroutine print_int
         end interface

         integer, allocatable :: foo(:,:)

         allocate (foo(2,2))
         foo(:,1) = [1, 2]
         foo(:,2) = [3, 4]

         call print_int (foo(:,2))

         associate (bar => foo(:,2))

         print *, bar

         call print_int (bar)

         end associate
       end program


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

end of thread, other threads:[~2013-08-27 11:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-20  8:01 [Bug fortran/49076] New: ASSOCIATE: Array descriptor passed to explicit-shaped dummy burnus at gcc dot gnu.org
2011-05-20 22:15 ` [Bug fortran/49076] " burnus at gcc dot gnu.org
2011-05-21  4:17 ` andrew.t.baldwin at me dot com
2013-08-27 11:13 ` [Bug fortran/49076] [F03] " mikael 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).