program had no :: in an initialization, but it ran
harperjf opened this issue · comments
harperjf commented
Fortran 2023 R801 says "If initialization appears, a double-colon separator shall appear before the entity-decl-list" but the program below ran in my Linux Ubuntu system.
program testmissingcolons
implicit none
integer n
character(3) data = '666' ! bad syntax
read(data,*) n
print *,'You said ',n
end program testmissingcolons
It gave this run-time output but it should not have compiled.
You said 666
Ondřej Čertík commented
GFortran says:
$ gfortran a.f90
a.f90:4:20:
4 | character(3) data = '666' ! bad syntax
| 1
Error: Syntax error in data declaration at (1)
We should catch it either directly in the parser, or note if ::
is present into AST and do it in AST->ASR, whichever is cleaner.