Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Lower / forall / degenerate.f90
blob70598c965b91fb9445d00612759e46469a9812de
1 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
3 ! CHECK-LABEL: func @_QPpointer_forall_degenerated_assignment() {
5 subroutine pointer_forall_degenerated_assignment()
6 integer, pointer :: p
7 integer, target :: t(1)
8 forall (i=1:1)
9 ! Test hits a TODO when uncommented.
10 ! p => t(i)
11 end forall
12 end subroutine
14 ! CHECK-LABEL: func @_QPlogical_forall_degenerated_assignment() {
15 ! CHECK: %[[VAL_0:.*]] = fir.alloca i32 {adapt.valuebyref, bindc_name = "i"}
16 ! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.logical<4> {bindc_name = "l", uniq_name = "_QFlogical_forall_degenerated_assignmentEl"}
17 ! CHECK: %[[VAL_2:.*]] = arith.constant 1 : i32
18 ! CHECK: %[[VAL_3:.*]] = fir.convert %[[VAL_2]] : (i32) -> index
19 ! CHECK: %[[VAL_4:.*]] = arith.constant 1 : i32
20 ! CHECK: %[[VAL_5:.*]] = fir.convert %[[VAL_4]] : (i32) -> index
21 ! CHECK: %[[VAL_6:.*]] = arith.constant 1 : index
22 ! CHECK: fir.do_loop %[[VAL_7:.*]] = %[[VAL_3]] to %[[VAL_5]] step %[[VAL_6]] unordered {
23 ! CHECK: %[[VAL_8:.*]] = fir.convert %[[VAL_7]] : (index) -> i32
24 ! CHECK: fir.store %[[VAL_8]] to %[[VAL_0]] : !fir.ref<i32>
25 ! CHECK: %[[VAL_9:.*]] = arith.constant true
26 ! CHECK: %[[VAL_10:.*]] = fir.convert %[[VAL_9]] : (i1) -> !fir.logical<4>
27 ! CHECK: fir.store %[[VAL_10]] to %[[VAL_1]] : !fir.ref<!fir.logical<4>>
28 ! CHECK: }
29 ! CHECK: return
30 ! CHECK: }
32 subroutine logical_forall_degenerated_assignment()
33 logical :: l
34 forall (i=1:1)
35 l = .true.
36 end forall
37 end subroutine