public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/41369]  New: Empty derived-type wrongly rejected as function return type
@ 2009-09-16  7:20 burnus at gcc dot gnu dot org
  2009-09-16  8:45 ` [Bug fortran/41369] " dominiq at lps dot ens dot fr
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-09-16  7:20 UTC (permalink / raw)
  To: gcc-bugs

(Motivated but independent from
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/817234ccd2b3ae1b#)

The following program is rejected in gfortran until one adds a component. I
agree that it is not particularly useful but I think it is standard conform.

In any case the error message is bogus:


type(t) function foo()
1
Error: The type for function 'foo' at (1) is not accessible


module m
 type t
 end type t
end module

type(t) function foo()
  use m
  foo = t()
end function foo


-- 
           Summary: Empty derived-type wrongly rejected as function return
                    type
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          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=41369


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

* [Bug fortran/41369] Empty derived-type wrongly rejected as function return type
  2009-09-16  7:20 [Bug fortran/41369] New: Empty derived-type wrongly rejected as function return type burnus at gcc dot gnu dot org
@ 2009-09-16  8:45 ` dominiq at lps dot ens dot fr
  2009-09-16 10:33 ` burnus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: dominiq at lps dot ens dot fr @ 2009-09-16  8:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dominiq at lps dot ens dot fr  2009-09-16 08:45 -------
The test is also rejected by g95 and ifort, the latter gives:

error #7128: A derived-type-def must have at least one component-def-stmt.


-- 


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


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

* [Bug fortran/41369] Empty derived-type wrongly rejected as function return type
  2009-09-16  7:20 [Bug fortran/41369] New: Empty derived-type wrongly rejected as function return type burnus at gcc dot gnu dot org
  2009-09-16  8:45 ` [Bug fortran/41369] " dominiq at lps dot ens dot fr
@ 2009-09-16 10:33 ` burnus at gcc dot gnu dot org
  2009-12-10 21:04 ` dfranke at gcc dot gnu dot org
  2009-12-10 21:05 ` dfranke at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu dot org @ 2009-09-16 10:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2009-09-16 10:33 -------
(In reply to comment #1)
> The test is also rejected by g95 and ifort, the latter gives:
> error #7128: A derived-type-def must have at least one component-def-stmt.

I did not claim that I have a valid Fortran 95 program - in Fortran 2003 it is
allowed.

And ifort 11.1 compiles it (well, at least without the empty structure
constructor which gives a "not yet implemented" error.).


-- 


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


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

* [Bug fortran/41369] Empty derived-type wrongly rejected as function return type
  2009-09-16  7:20 [Bug fortran/41369] New: Empty derived-type wrongly rejected as function return type burnus at gcc dot gnu dot org
  2009-09-16  8:45 ` [Bug fortran/41369] " dominiq at lps dot ens dot fr
  2009-09-16 10:33 ` burnus at gcc dot gnu dot org
@ 2009-12-10 21:04 ` dfranke at gcc dot gnu dot org
  2009-12-10 21:05 ` dfranke at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-12-10 21:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dfranke at gcc dot gnu dot org  2009-12-10 21:04 -------
Subject: Bug 41369

Author: dfranke
Date: Thu Dec 10 21:03:40 2009
New Revision: 155141

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=155141
Log:
2009-12-10  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/41369
        * parse.c (match_deferred_characteristics): Removed check for empty
        types in function return values.

2009-12-10  Daniel Franke  <franke.daniel@gmail.com>

        PR fortran/41369
        * gfortran.dg/func_derived_5.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/func_derived_5.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/parse.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/41369] Empty derived-type wrongly rejected as function return type
  2009-09-16  7:20 [Bug fortran/41369] New: Empty derived-type wrongly rejected as function return type burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-12-10 21:04 ` dfranke at gcc dot gnu dot org
@ 2009-12-10 21:05 ` dfranke at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: dfranke at gcc dot gnu dot org @ 2009-12-10 21:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dfranke at gcc dot gnu dot org  2009-12-10 21:05 -------
Fixed in trunk. Closing.


-- 

dfranke at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dfranke at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


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


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

end of thread, other threads:[~2009-12-10 21:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-16  7:20 [Bug fortran/41369] New: Empty derived-type wrongly rejected as function return type burnus at gcc dot gnu dot org
2009-09-16  8:45 ` [Bug fortran/41369] " dominiq at lps dot ens dot fr
2009-09-16 10:33 ` burnus at gcc dot gnu dot org
2009-12-10 21:04 ` dfranke at gcc dot gnu dot org
2009-12-10 21:05 ` dfranke 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).