The following is invalid and rejected using -std=f2003, but I wonder whether
one should not also reject it otherwise? What is the string length?

function a(n,m)
   integer :: n,m
   character(n) a
   character(m) a
end

ifort and g95 reject it always.

 * * *

If one wants to add only a check whether the variables are the same, one could
use the same check for:

function a(n,m)
   integer :: n,m
   character(n) a
   character(m) b
entry b(n,m)
end

NAG f95 and ifort reject this with:
- Incompatible character length for ENTRY B of function A
- The characteristics of the function named on the ENTRY statement are
different from the characteristics of the result of the function named on the
FUNCTION statement.

gfortran currently (PR34421) accepts this for non-constant expressions.


-- 
           Summary: Declaring a variable twice with different
                    characteristics
           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=34527

Reply via email to