public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/22571] New: error needed
@ 2005-07-20 15:54 jv244 at cam dot ac dot uk
  2005-07-22 11:56 ` [Bug fortran/22571] Reject derived types for dummy arguments declared in the subroutine unless they are SEQUENCE tkoenig at gcc dot gnu dot org
  0 siblings, 1 reply; 14+ messages in thread
From: jv244 at cam dot ac dot uk @ 2005-07-20 15:54 UTC (permalink / raw)
  To: gcc-bugs

related to inlining of fortran functions :

http://gcc.gnu.org/ml/gcc/2005-07/msg00860.html

the following code is non-standard (but gfortran 'fails' to generate an error):

subroutine a(p)
  type t
    integer :: t1
  end type
  type(t) :: p
  p%t1 = 42
end subroutine
subroutine b
  type u
    integer :: u1
  end type
  type (u) :: q
  call a(q)
  print * q%u1
end subroutine

NAG:
Error: mytest.f90: Argument P (no. 1) in reference to A from B has the wrong
data type

LAHEY:line 14: Argument number '1' type of procedure 'a' shall be the same
between definition and reference.

Only the following is accepted by both compilers (and is standard conforming):

subroutine a(p)
  type t
    sequence
    integer :: t1
  end type
  type(t) :: p
  p%t1 = 42
end subroutine
subroutine b
  type t
    sequence
    integer :: t1
  end type
  type (t) :: q
  call a(q)
end subroutine

in particular same name of the types, sequence type, and same name of the
components, see 4.4.2 for a precise definition about when two derived types are
the same.

Joost

-- 
           Summary: error needed
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jv244 at cam dot ac dot uk
                CC: gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2010-05-08 20:07 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-22571-6642@http.gcc.gnu.org/bugzilla/>
2006-01-07  5:47 ` [Bug fortran/22571] Reject derived types for dummy arguments declared in the subroutine unless they are SEQUENCE pinskia at gcc dot gnu dot org
2006-02-11 21:20 ` pinskia at gcc dot gnu dot org
2006-06-23  8:25 ` paul dot richard dot thomas at cea dot fr
2006-10-03 15:06 ` pault at gcc dot gnu dot org
2007-08-14 14:11 ` fxcoudert at gcc dot gnu dot org
2007-08-14 15:48 ` burnus at gcc dot gnu dot org
2007-08-14 20:26 ` fxcoudert at gcc dot gnu dot org
2007-10-07 17:16 ` tobi at gcc dot gnu dot org
2008-12-05 16:29 ` jv244 at cam dot ac dot uk
2009-03-30 19:36 ` pault at gcc dot gnu dot org
2009-04-10 22:13 ` dfranke at gcc dot gnu dot org
2009-12-08 21:33 ` dfranke at gcc dot gnu dot org
2010-05-08 20:07 ` dfranke at gcc dot gnu dot org
2005-07-20 15:54 [Bug fortran/22571] New: error needed jv244 at cam dot ac dot uk
2005-07-22 11:56 ` [Bug fortran/22571] Reject derived types for dummy arguments declared in the subroutine unless they are SEQUENCE tkoenig 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).