[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / omp-allocate03.f90
blob8d3c0cca494a7ac00f19f7afb8f69dadf712096e
1 ! RUN: %S/test_errors.sh %s %t %flang_fc1 -fopenmp
2 ! REQUIRES: shell
3 ! OpenMP Version 5.0
4 ! 2.11.3 allocate Directive
5 ! A variable that is part of another variable (as an array or
6 ! structure element) cannot appear in an allocate directive.
7 subroutine allocate()
8 use omp_lib
10 type my_type
11 integer :: array(10)
12 end type my_type
13 type(my_type) :: my_var
14 real, dimension (:,:), allocatable :: darray
15 integer :: a, b
17 !!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear in an ALLOCATE directive
18 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear in a PRIVATE or SHARED clause or on the ALLOCATE directive.
19 !$omp allocate(my_var%array)
21 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear in a PRIVATE or SHARED clause or on the ALLOCATE directive.
22 !$omp allocate(darray, my_var%array) allocator(omp_default_mem_alloc)
23 allocate ( darray(a, b) )
25 end subroutine allocate