xref: /llvm-project/flang/test/Semantics/error_stop1b.f90 (revision 21dceb3ca67cdc0e05b95e1d229bd01a8cd29f60)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2! This test checks for semantic errors in error stop statements based on the
3! statement specification in section 11.4 of the Fortran 2018 standard.
4! The errors in this test would be hidden by the errors in
5! the test error_stop01a.f90 if they were included in that file,
6! and are thus tested here.
7
8program test_error_stop
9  implicit none
10
11  integer int_code, int_array(1), int_coarray[*], array_coarray(1)[*]
12  integer(kind=1) non_default_int_kind
13  character(len=128) char_code, char_array(1), char_coarray[*], non_logical
14  character(kind=4, len=128) non_default_char_kind
15  logical bool, logical_array(1), logical_coarray[*], non_integer, non_character
16
17  !___ non-standard-conforming statements _________________________
18
19  !ERROR: Stop code must be of INTEGER or CHARACTER type
20  error stop non_integer
21
22  !ERROR: Stop code must be of INTEGER or CHARACTER type
23  error stop non_character
24
25  !ERROR: INTEGER stop code must be of default kind
26  error stop non_default_int_kind
27
28  !ERROR: CHARACTER stop code must be of default kind
29  error stop non_default_char_kind
30
31  !ERROR: Must be a scalar value, but is a rank-1 array
32  error stop char_array
33
34  !ERROR: Must be a scalar value, but is a rank-1 array
35  error stop array_coarray[1]
36
37  !ERROR: Must have LOGICAL type, but is CHARACTER(KIND=1,LEN=128_8)
38  error stop int_code, quiet=non_logical
39
40  !ERROR: Must be a scalar value, but is a rank-1 array
41  error stop int_code, quiet=logical_array
42
43end program test_error_stop
44