public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/33334]  New: User-defined type as function result in an interface: Accepts invalid
@ 2007-09-07 15:01 burnus at gcc dot gnu dot org
  2007-09-08  8:10 ` [Bug fortran/33334] User-defined type as function result: use-assocciated not accepted burnus at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-09-07 15:01 UTC (permalink / raw)
  To: gcc-bugs

(Split off from PR 31154.)
The following is accepted but invalid (without using "IMPORT t"):

module x
 implicit none
 type t
   integer :: i
 end type t
 interface
   type(t) function bar()
   end function
 end interface
end


-- 
           Summary: User-defined type as function result in an interface:
                    Accepts invalid
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


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

* [Bug fortran/33334] User-defined type as function result: use-assocciated not accepted
  2007-09-07 15:01 [Bug fortran/33334] New: User-defined type as function result in an interface: Accepts invalid burnus at gcc dot gnu dot org
@ 2007-09-08  8:10 ` burnus at gcc dot gnu dot org
  2007-09-21 20:56 ` pault at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-09-08  8:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2007-09-08 08:09 -------
This probably needs the same technique as PR31229 / PR31154.

The following program is valid, but rejected by gfortran (also if one does not
rename the symbol):

  func%i = 5
     1
Error: Derived type 'z' at (1) is being used before it is defined
a.f90:7.21:

type(z) function func()
                    1
Error: The derived type 'func' at (1) is of type 'z', which has not been
defined


module x
 type t
   integer :: i
 end type t
end module x

type(z) function func()
  use x, only: z=>t
  func%i = 5
end function func


This program is accepted by NAG f95, g95, ifort, openf95 and sunf95.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |32834
              nThis|                            |
           Keywords|                            |rejects-valid
            Summary|User-defined type as        |User-defined type as
                   |function result in an       |function result: use-
                   |interface: Accepts invalid  |assocciated not accepted


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


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

* [Bug fortran/33334] User-defined type as function result: use-assocciated not accepted
  2007-09-07 15:01 [Bug fortran/33334] New: User-defined type as function result in an interface: Accepts invalid burnus at gcc dot gnu dot org
  2007-09-08  8:10 ` [Bug fortran/33334] User-defined type as function result: use-assocciated not accepted burnus at gcc dot gnu dot org
@ 2007-09-21 20:56 ` pault at gcc dot gnu dot org
  2007-09-22 18:42 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-09-21 20:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pault at gcc dot gnu dot org  2007-09-21 20:55 -------
I've just sorted PRs 33337 and 33376, so I'll tunr back to these fellows next.

This is confirmed, of course.

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-09-21 20:55:53
               date|                            |


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


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

* [Bug fortran/33334] User-defined type as function result: use-assocciated not accepted
  2007-09-07 15:01 [Bug fortran/33334] New: User-defined type as function result in an interface: Accepts invalid burnus at gcc dot gnu dot org
  2007-09-08  8:10 ` [Bug fortran/33334] User-defined type as function result: use-assocciated not accepted burnus at gcc dot gnu dot org
  2007-09-21 20:56 ` pault at gcc dot gnu dot org
@ 2007-09-22 18:42 ` pault at gcc dot gnu dot org
  2007-10-02  7:17 ` pault at gcc dot gnu dot org
  2007-10-02  7:24 ` pault at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-09-22 18:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pault at gcc dot gnu dot org  2007-09-22 18:42 -------
I'll do all of these, having started.

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-09-21 20:55:53         |2007-09-22 18:42:21
               date|                            |


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


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

* [Bug fortran/33334] User-defined type as function result: use-assocciated not accepted
  2007-09-07 15:01 [Bug fortran/33334] New: User-defined type as function result in an interface: Accepts invalid burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-09-22 18:42 ` pault at gcc dot gnu dot org
@ 2007-10-02  7:17 ` pault at gcc dot gnu dot org
  2007-10-02  7:24 ` pault at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-10-02  7:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2007-10-02 07:17 -------
Subject: Bug 33334

Author: pault
Date: Tue Oct  2 07:17:01 2007
New Revision: 128948

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128948
Log:
2007-10-02  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/31154
        PR fortran/31229
        PR fortran/33334
        * decl.c : Declare gfc_function_kind_locs and
        gfc_function_type_locus.
        (gfc_match_kind_spec): Add second argument kind_expr_only.
        Store locus before trying to match the expression. If the
        current state corresponds to a function declaration and there
        is no match to the expression, read to the parenthesis, return
        kind = -1, dump the expression and return.
        (gfc_match_type_spec): Renamed from match_type_spec and all
        references changed.  If an interface or an external function,
        store the locus, set kind = -1 and return.  Otherwise, if kind
        is already = -1, use gfc_find_symbol to try to find a use
        associated or imported type.
        match.h : Prototype for gfc_match_type_spec.
        * parse.c (match_deferred_characteristics): New function.
        (parse_spec): If in a function, statement is USE or IMPORT
        or DERIVED_DECL and the function kind=-1, call
        match_deferred_characteristics.  If kind=-1 at the end of the
        specification expressions, this is an error.
        * parse.h : Declare external gfc_function_kind_locs and
        gfc_function_type_locus.

2007-10-02  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/31154
        PR fortran/31229
        PR fortran/33334
        * gfortran.dg/function_kinds_1.f90: New test.
        * gfortran.dg/function_kinds_2.f90: New test.
        * gfortran.dg/derived_function_interface_1.f90: Correct illegal
        use association into interfaces.


Added:
    trunk/gcc/testsuite/gfortran.dg/function_kinds_1.f90
    trunk/gcc/testsuite/gfortran.dg/function_kinds_2.f90
    trunk/gcc/testsuite/gfortran.dg/intent_out_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/fortran/match.h
    trunk/gcc/fortran/parse.c
    trunk/gcc/fortran/parse.h
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/derived_function_interface_1.f90


-- 


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


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

* [Bug fortran/33334] User-defined type as function result: use-assocciated not accepted
  2007-09-07 15:01 [Bug fortran/33334] New: User-defined type as function result in an interface: Accepts invalid burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-10-02  7:17 ` pault at gcc dot gnu dot org
@ 2007-10-02  7:24 ` pault at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-10-02  7:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pault at gcc dot gnu dot org  2007-10-02 07:24 -------
Fixed on trunk

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2007-10-02  7:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-07 15:01 [Bug fortran/33334] New: User-defined type as function result in an interface: Accepts invalid burnus at gcc dot gnu dot org
2007-09-08  8:10 ` [Bug fortran/33334] User-defined type as function result: use-assocciated not accepted burnus at gcc dot gnu dot org
2007-09-21 20:56 ` pault at gcc dot gnu dot org
2007-09-22 18:42 ` pault at gcc dot gnu dot org
2007-10-02  7:17 ` pault at gcc dot gnu dot org
2007-10-02  7:24 ` pault 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).