Bug 34137 - Module function with ENTRY rejected
Summary: Module function with ENTRY rejected
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks: 32834 34079
  Show dependency treegraph
 
Reported: 2007-11-18 09:42 UTC by Tobias Burnus
Modified: 2007-11-18 17:14 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.1.3 4.2.2 4.3.0
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2007-11-18 09:42:23 UTC
The following program should print
 12
 -14.0000000
but gfortran rejects it with
  Error: Contained function 'master.0.func' at (1) has no IMPLICIT type

It fails with GCC 4.1.3, 4.2.1 and 4.3.0 with:

end module m
           1
Error: Contained function 'master.0.func' at (1) has no IMPLICIT type

The same program compiles with NAG f95, g95, ifort. If one puts the procedure not into a module, it works.

module m
  implicit none
contains
function func(a)
  integer :: a, func
  real :: ent
  func = a*4
  return
entry ent(a)
  ent = -a*2.0
  return
end function func
end module m
program main
  use m
  implicit none
  print *, func(3)
  print *, ent(7)
end program main
Comment 1 Tobias Burnus 2007-11-18 16:35:23 UTC
Subject: Bug 34137

Author: burnus
Date: Sun Nov 18 16:35:12 2007
New Revision: 130270

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130270
Log:
2007-11-18  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34137
        * primary.c (match_variable): Reject non-result entry symbols.
        * resolve.c (resolve_contained_fntype): Do not check entry
        * master functions.

2007-11-18  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34137
        * gfortran.dg/entry_14.f90: New.
        * gfortran.dg/entry_15.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/entry_14.f90
    trunk/gcc/testsuite/gfortran.dg/entry_15.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/primary.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog

Comment 2 Tobias Burnus 2007-11-18 17:14:10 UTC
FIXED on the trunk (4.3.0). Was simpler than I thought.
Comment 3 patchapp@dberlin.org 2007-11-20 05:04:28 UTC
Subject: Bug number PR34137

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-11/msg00965.html