1 // Test side effects of hlfir.assign op.
2 // RUN: fir-opt %s --test-side-effects --verify-diagnostics
4 func.func @test1(%x: !fir.ref<i32>, %i: i32) {
5 // expected-remark @below {{found an instance of 'write' on a op operand, on resource '<Default>'}}
6 hlfir.assign %i to %x : i32, !fir.ref<i32>
10 func.func @test2(%x: !fir.ref<i32>, %y: !fir.ref<i32>) {
11 // expected-remark @below {{found an instance of 'write' on a op operand, on resource '<Default>'}}
12 // expected-remark @below {{found an instance of 'read' on a op operand, on resource '<Default>'}}
13 hlfir.assign %y to %x : !fir.ref<i32>, !fir.ref<i32>
17 func.func @test3(%x: !fir.ref<!fir.type<t>>, %y: !fir.ref<!fir.type<t>>) {
18 // expected-remark @below {{found an instance of 'write' on resource '<Default>'}}
19 // expected-remark @below {{found an instance of 'read' on resource '<Default>'}}
20 hlfir.assign %y to %x : !fir.ref<!fir.type<t>>, !fir.ref<!fir.type<t>>
24 func.func @test4(%x: !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>, %y: !fir.box<!fir.array<?xi32>>) {
25 // expected-remark @below {{found an instance of 'read' on a op operand, on resource '<Default>'}}
26 // expected-remark @below {{found an instance of 'write' on resource '<Default>'}}
27 // expected-remark @below {{found an instance of 'free' on resource '<Default>'}}
28 // expected-remark @below {{found an instance of 'allocate' on resource '<Default>'}}
29 hlfir.assign %y to %x realloc : !fir.box<!fir.array<?xi32>>, !fir.ref<!fir.box<!fir.heap<!fir.array<?xi32>>>>