Files
clang-p2996/flang/test/Semantics/data17.f90
Peter Klausler 2dab5bdf89 [flang] Warn on mismatched DATA substring sizes rather than crashing
When a DATA statement initializes a substring with a character constant
of the wrong length, do the right thing with blank padding or truncation,
and emit a warning.  Current code is crashing due to an unhandled error
reported from the low-level data image initialization framework.

Differential Revision: https://reviews.llvm.org/D143819
2023-02-13 12:31:05 -08:00

12 lines
424 B
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
character(4) a, b, c, d, e
!WARNING: DATA statement value '"abcde"' for 'a' has the wrong length
data a(1:4)/'abcde'/
!WARNING: DATA statement value '"abc"' for 'b' has the wrong length
data b(1:4)/'abc'/
data c/'abcde'/ ! not a substring, conforms
data d/'abc'/ ! not a substring, conforms
!ERROR: DATA statement designator 'e(1_8:5_8)' is out of range
data e(1:5)/'xyz'/
end