[Bug fortran/34421] New: ENTRY functions: Character with different stringlength not rejected

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Dec 10 17:10:00 GMT 2007


"If the characteristics of the result of the function named in the ENTRY
statement are the same as the characteristics of the result of the function
named in the FUNCTION statement, their result variables identify the same
variable, although their names need not be the same. Otherwise, they are
storage associated and shall all be nonpointer, nonallocatable scalars of type
default integer, default real, double precision real, default complex, or
default logical."

We can continue to allow allow the following program, but it should be rejected
for -std=f95/f2003:

ifort diagnoses:
Error: line 7: The character lengths of the functions must not be different. 

NAG f95:
Error: line 9: Incompatible character length for ENTRY BAR of function TEST

function test()
  implicit none
  character(len=10) :: test
  character(len=1) :: bar
  test ="aaa"
  return
entry bar()
  bar = "h"
end function test

 * * *

The following program is (correctly) rejected, but the error message could be
improved:

Error: ENTRY result bar2 can't be of type CHARACTER(1) in FUNCTION test2 at (1)

NAG f95:
Error: aa.f90, line 9: Storage-associated ENTRY point BAR2 does not have
default kind

Maybe something like:
"Result characteristics of ENTRY function '%s' at %L and FUNCTION '%s' at %L
shall either be the same or both non-character default-kind scalars."

function test2()
  implicit none
  integer :: test2
  character :: bar
  test2 ="aaa"
  return
entry bar2()
  bar = "h"
end function test2


-- 
           Summary: ENTRY functions: Character with different stringlength
                    not rejected
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, diagnostic
          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=34421



More information about the Gcc-bugs mailing list