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-20 16:35 ` [Bug fortran/22571] " pinskia at gcc dot gnu dot org
  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, 2 replies; 3+ 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] 3+ messages in thread

* [Bug fortran/22571] error needed
  2005-07-20 15:54 [Bug fortran/22571] New: error needed jv244 at cam dot ac dot uk
@ 2005-07-20 16:35 ` pinskia at gcc dot gnu dot org
  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
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-20 16:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-20 15:55 -------
Hmm, ICC accepts the code too.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid, diagnostic


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


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

* [Bug fortran/22571] Reject derived types for dummy arguments declared in the subroutine unless they are SEQUENCE
  2005-07-20 15:54 [Bug fortran/22571] New: error needed jv244 at cam dot ac dot uk
  2005-07-20 16:35 ` [Bug fortran/22571] " pinskia at gcc dot gnu dot org
@ 2005-07-22 11:56 ` tkoenig at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2005-07-22 11:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tkoenig at gcc dot gnu dot org  2005-07-22 11:30 -------
Confirmed.

We need to reject dummy arguments if

- they are of a derived type
- the derived type is declared in that subroutine
- they aren't sequence types.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-07-22 11:30:58
               date|                            |
            Summary|error needed                |Reject derived types for
                   |                            |dummy arguments declared in
                   |                            |the subroutine unless they
                   |                            |are SEQUENCE


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


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

end of thread, other threads:[~2005-07-22 11:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-20 15:54 [Bug fortran/22571] New: error needed jv244 at cam dot ac dot uk
2005-07-20 16:35 ` [Bug fortran/22571] " pinskia at gcc dot gnu dot org
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).