This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/22571] New: error needed


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]