Bug 34527 - Declaring a variable twice with different characteristics
Summary: Declaring a variable twice with different characteristics
Status: RESOLVED DUPLICATE of bug 37412
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2007-12-19 00:01 UTC by Tobias Burnus
Modified: 2009-12-08 20:58 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-03-13 14:30:01


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2007-12-19 00:01:56 UTC
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.
Comment 1 Daniel Franke 2009-12-08 20:58:30 UTC
Marking as dupe, discussion happened in PR37412.

*** This bug has been marked as a duplicate of 37412 ***