|
| 1 | +! RUN: %python %S/test_errors.py %s %flang_fc1 |
| 2 | +! Test error message priorities for DATA problems |
| 3 | +module m |
| 4 | + integer useAlloc |
| 5 | + allocatable useAlloc |
| 6 | + integer, pointer :: usePtr(:) |
| 7 | + contains |
| 8 | + subroutine useProc |
| 9 | + end |
| 10 | +end |
| 11 | +function f(hostDummy, hostProc) result(hostResult) |
| 12 | + integer hostDummy, hostResult |
| 13 | + external hostProc |
| 14 | + integer hostAuto(hostDummy) |
| 15 | + integer, allocatable :: hostAlloc |
| 16 | + integer :: hostInit = 1 |
| 17 | + integer, pointer :: hostPtr(:) |
| 18 | + contains |
| 19 | + subroutine test(innerDummy, innerProc) |
| 20 | + use m |
| 21 | + external innerProc |
| 22 | + integer innerAuto(innerDummy) |
| 23 | + integer, allocatable :: innerAlloc |
| 24 | + integer :: innerInit = 1 |
| 25 | + integer, pointer :: innerPtr(:) |
| 26 | + !ERROR: Procedure 'useproc' must not be initialized in a DATA statement |
| 27 | + data useProc/0/ |
| 28 | + !ERROR: Procedure 'hostproc' must not be initialized in a DATA statement |
| 29 | + data hostProc/0/ |
| 30 | + !ERROR: Procedure 'innerproc' must not be initialized in a DATA statement |
| 31 | + data innerProc/0/ |
| 32 | + !ERROR: Host-associated object 'hostdummy' must not be initialized in a DATA statement |
| 33 | + data hostDummy/1/ |
| 34 | + !ERROR: Host-associated object 'hostresult' must not be initialized in a DATA statement |
| 35 | + data hostResult/1/ |
| 36 | + !ERROR: Host-associated object 'hostauto' must not be initialized in a DATA statement |
| 37 | + data hostAuto/1/ |
| 38 | + !ERROR: Host-associated object 'hostalloc' must not be initialized in a DATA statement |
| 39 | + data hostAlloc/1/ |
| 40 | + !ERROR: Host-associated object 'hostinit' must not be initialized in a DATA statement |
| 41 | + data hostInit/1/ |
| 42 | + !ERROR: Host-associated object 'hostptr' must not be initialized in a DATA statement |
| 43 | + data hostPtr(1)/1/ |
| 44 | + !ERROR: USE-associated object 'usealloc' must not be initialized in a DATA statement |
| 45 | + data useAlloc/1/ |
| 46 | + !ERROR: USE-associated object 'useptr' must not be initialized in a DATA statement |
| 47 | + data usePtr(1)/1/ |
| 48 | + !ERROR: Dummy argument 'innerdummy' must not be initialized in a DATA statement |
| 49 | + data innerDummy/1/ |
| 50 | + !ERROR: Automatic variable 'innerauto' must not be initialized in a DATA statement |
| 51 | + data innerAuto/1/ |
| 52 | + !ERROR: Allocatable 'inneralloc' must not be initialized in a DATA statement |
| 53 | + data innerAlloc/1/ |
| 54 | + !ERROR: Default-initialized 'innerinit' must not be initialized in a DATA statement |
| 55 | + data innerInit/1/ |
| 56 | + !ERROR: Target of pointer 'innerptr' must not be initialized in a DATA statement |
| 57 | + data innerptr(1)/1/ |
| 58 | + end |
| 59 | +end |
0 commit comments