Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29341 Discussions

Unhelpful error message array section assignment

DavidWhite
Valued Contributor II
1,432 Views

I am attempting to assign an array section, e.g.

X(1:N) = Y(1:N)

In the situation that Y has not been declared, the compiler only seems to look at the RHS of the statement, and so assumes that Y is intended to be of CHARACTER type, failing to recognize that the notation also could be an array section.  Since the destination is an array section, then error message 6514 is misleading.

Error 1  error #6404: This name does not have a type, and must have an explicit type.   [UNDECLAREDVAR] C:\Open\kwc54dw\Dev\Winyldmd\trunk\ymd_commands\Show_Stage.f90 107 
Error 2  error #6514: A substring must be of type CHARACTER.   [UNDECLAREDVAR] C:\Open\kwc54dw\Dev\Winyldmd\trunk\ymd_commands\Show_Stage.f90 107 
Error 3  error #6303: The assignment operation or the binary expression operation is invalid for the data types of the two operands.   [UNDECLAREDVAR] C:\Open\kwc54dw\Dev\Winyldmd\trunk\ymd_commands\Show_Stage.f90 107 
 

0 Kudos
4 Replies
Steven_L_Intel1
Employee
1,432 Views

Well, the language doesn't make any connection between the left and right side of an assignment, and neither does the compiler. Generally, if something is not declared to be an array the compiler assumes it isn't one. But maybe error 6514 could be reworded to be something like "Substring or array slice notation for variable not declared as CHARACTER or array"?

0 Kudos
DavidWhite
Valued Contributor II
1,432 Views

Steve,

I think your suggested wording for 6514 would make more sense.  As it reads, it assumes that the n:m notation only applies to CHARACTER variables, which I guess was true before array slices were permitted.

David

0 Kudos
Steven_L_Intel1
Employee
1,432 Views

Escalated as issue ID DPD200368064.

0 Kudos
Steven_L_Intel1
Employee
1,432 Views

Fixed for a future major release.

0 Kudos
Reply