xref: /llvm-project/flang/test/Semantics/definable05.cuf (revision f513bd808867757a92791fb61d893534cafbe0b3)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2module m
3  real, constant :: rc
4  !ERROR: Object 'rcp' with ATTRIBUTES(CONSTANT) may not be allocatable, pointer, or target
5  real, constant, pointer :: rcp
6  !ERROR: Object 'rct' with ATTRIBUTES(CONSTANT) may not be allocatable, pointer, or target
7  real, constant, target :: rct
8  real, device, pointer :: dp(:)
9  real, device, target :: dt(100)
10 contains
11  attributes(device) subroutine devsub
12    !ERROR: Left-hand side of assignment is not definable
13    !BECAUSE: 'rc' has ATTRIBUTES(CONSTANT) and is not definable in a device subprogram
14    rc = 1.
15    !ERROR: The left-hand side of a pointer assignment is not definable
16    !BECAUSE: 'dp' is a pointer and may not be associated in a device subprogram
17    dp => dt
18  end
19  attributes(global) subroutine globsub
20    !ERROR: Left-hand side of assignment is not definable
21    !BECAUSE: 'rc' has ATTRIBUTES(CONSTANT) and is not definable in a device subprogram
22    rc = 1.
23    !ERROR: The left-hand side of a pointer assignment is not definable
24    !BECAUSE: 'dp' is a pointer and may not be associated in a device subprogram
25    dp => dt
26  end
27  subroutine hostsub
28    rc = 1.
29    dp => dt
30  end
31end
32