f18 icon indicating copy to clipboard operation
f18 copied to clipboard

Confusing parse error on bad codimension

Open tskeith opened this issue 5 years ago • 3 comments

Test case:

real :: a[1:10,1:10]
end

Compiling this, f18 give the following errors:

t.f90:1:6: error: expected '('
  real :: a[1:10,1:10]
       ^
t.f90:1:1: in the context: statement function definition
  real :: a[1:10,1:10]
  ^
t.f90:1:1: in the context: declaration construct
t.f90:1:1: in the context: specification part
t.f90:1:1: in the context: main program

A similar error occurs with real, codimension[1:10,1:10] :: a

tskeith avatar Apr 02 '19 23:04 tskeith

Here's another example: real :: a[1:*](4)

tskeith avatar Apr 02 '19 23:04 tskeith

ifort produces "error #7271: Not a valid attribute for the DEC$ ATTRIBUTES directive." so things could be worse.

klausler avatar Apr 02 '19 23:04 klausler

gfortran does well on real :: a[1:10,1:10]: Error: Upper bound of last coarray dimension must be '*'

But not so well on real, dimension(5) :: a[1:10,1:*](4,4): f951: internal compiler error: free_expr0(): Bad expr type

tskeith avatar Apr 02 '19 23:04 tskeith