Skip to content

Commit 8df5913

Browse files
committed
[flang][hlfir] Fixed length-one assignment.
Assignment from a character dummy argument to a length-one character variable resulted in illegal fir.convert: %0 = fir.load %unboxed_dummy : !fir.ref<!fir.char<1,?>> %1 = fir.convert %0 : (!fir.char<1,?>) -> !fir.char<1> fir.store %1 to %local : !fir.ref<!fir.char<1>> This change fixes the length-one assignment code to use proper casts. For character dummy arguments with constant length we will now also type cast the unboxed reference to the character type with constant length during the lowering: fir.convert %x : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.char<1,8>> I also adjusted the length-one assignment recognition so that in case of same-length assignment we recognize length-one from either LHS or RHS data types. Reviewed By: jeanPerier Differential Revision: https://reviews.llvm.org/D149382
1 parent 6db45cc commit 8df5913

21 files changed

+356
-260
lines changed

flang/lib/Lower/ConvertVariable.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,14 +1840,15 @@ void Fortran::lower::mapSymbolAttributes(
18401840
}
18411841
}
18421842

1843+
if (addr && addr.getDefiningOp<fir::UnboxCharOp>()) {
1844+
// Ensure proper type is given to array/scalar that transited via
1845+
// fir.boxchar arg.
1846+
mlir::Type castTy = builder.getRefType(converter.genType(var));
1847+
addr = builder.createConvert(loc, castTy, addr);
1848+
}
1849+
18431850
// Compute array extents and lower bounds.
18441851
if (ba.isArray()) {
1845-
if (addr && addr.getDefiningOp<fir::UnboxCharOp>()) {
1846-
// Ensure proper type is given to array that transited via fir.boxchar
1847-
// arg.
1848-
mlir::Type castTy = builder.getRefType(converter.genType(var));
1849-
addr = builder.createConvert(loc, castTy, addr);
1850-
}
18511852
if (ba.isStaticArray()) {
18521853
if (ba.lboundIsAllOnes()) {
18531854
for (std::int64_t extent :

flang/lib/Optimizer/Builder/Character.cpp

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,19 @@ void fir::factory::CharacterExprHelper::createLengthOneAssign(
400400
auto addr = lhs.getBuffer();
401401
auto toTy = fir::unwrapRefType(addr.getType());
402402
mlir::Value val = rhs.getBuffer();
403-
if (fir::isa_ref_type(val.getType()))
404-
val = builder.create<fir::LoadOp>(loc, val);
405-
val = builder.createConvert(loc, toTy, val);
406-
builder.create<fir::StoreOp>(loc, val, addr);
403+
if (fir::isa_ref_type(val.getType())) {
404+
auto fromCharLen1RefTy = builder.getRefType(getSingletonCharType(
405+
builder.getContext(),
406+
getCharacterKind(fir::unwrapRefType(val.getType()))));
407+
val = builder.create<fir::LoadOp>(
408+
loc, builder.createConvert(loc, fromCharLen1RefTy, val));
409+
}
410+
auto toCharLen1Ty =
411+
getSingletonCharType(builder.getContext(), getCharacterKind(toTy));
412+
val = builder.createConvert(loc, toCharLen1Ty, val);
413+
builder.create<fir::StoreOp>(
414+
loc, val,
415+
builder.createConvert(loc, builder.getRefType(toCharLen1Ty), addr));
407416
}
408417

409418
/// Returns the minimum of integer mlir::Value \p a and \b.
@@ -418,11 +427,29 @@ void fir::factory::CharacterExprHelper::createAssign(
418427
const fir::CharBoxValue &lhs, const fir::CharBoxValue &rhs) {
419428
auto rhsCstLen = getCompileTimeLength(rhs);
420429
auto lhsCstLen = getCompileTimeLength(lhs);
421-
bool compileTimeSameLength =
422-
(lhsCstLen && rhsCstLen && *lhsCstLen == *rhsCstLen) ||
423-
(rhs.getLen() == lhs.getLen());
424-
425-
if (compileTimeSameLength && lhsCstLen && *lhsCstLen == 1) {
430+
bool compileTimeSameLength = false;
431+
bool isLengthOneAssign = false;
432+
433+
if (lhsCstLen && rhsCstLen && *lhsCstLen == *rhsCstLen) {
434+
compileTimeSameLength = true;
435+
if (*lhsCstLen == 1)
436+
isLengthOneAssign = true;
437+
} else if (rhs.getLen() == lhs.getLen()) {
438+
compileTimeSameLength = true;
439+
440+
// If the length values are the same for LHS and RHS,
441+
// then we can rely on the constant length deduced from
442+
// any of the two types.
443+
if (lhsCstLen && *lhsCstLen == 1)
444+
isLengthOneAssign = true;
445+
if (rhsCstLen && *rhsCstLen == 1)
446+
isLengthOneAssign = true;
447+
448+
// We could have recognized constant operations here (e.g.
449+
// two different arith.constant ops may produce the same value),
450+
// but for now leave it to CSE to get rid of the duplicates.
451+
}
452+
if (isLengthOneAssign) {
426453
createLengthOneAssign(lhs, rhs);
427454
return;
428455
}

flang/test/HLFIR/char_assign.fir

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// RUN: fir-opt --split-input-file %s -convert-hlfir-to-fir | FileCheck %s
2+
3+
// Verify that the special case of length-one character assignment
4+
// is using valid fir.converts.
5+
6+
// -----
7+
8+
// CHECK-LABEL: func.func @_QPtest1
9+
// CHECK: [[C_DECL:%[0-9]*]] = fir.declare{{.*}}{uniq_name = "_QFtest1Ec"} : (!fir.ref<!fir.char<1,?>>, index) -> !fir.ref<!fir.char<1,?>>
10+
// CHECK: [[LOCAL_DECL:%[0-9]*]] = fir.declare{{.*}}{uniq_name = "_QFtest1Elocal"} : (!fir.ref<!fir.char<1>>, index) -> !fir.ref<!fir.char<1>>
11+
// CHECK: [[CVT:%[0-9]*]] = fir.convert [[C_DECL]] : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.char<1>>
12+
// CHECK: [[LD:%[0-9]*]] = fir.load [[CVT]] : !fir.ref<!fir.char<1>>
13+
// CHECK: fir.store [[LD]] to [[LOCAL_DECL]] : !fir.ref<!fir.char<1>>
14+
module {
15+
func.func @_QPtest1(%arg0: !fir.boxchar<1> {fir.bindc_name = "c"}) {
16+
%c1 = arith.constant 1 : index
17+
%0:2 = fir.unboxchar %arg0 : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index)
18+
%1:2 = hlfir.declare %0#0 typeparams %c1 {uniq_name = "_QFtest1Ec"} : (!fir.ref<!fir.char<1,?>>, index) -> (!fir.boxchar<1>, !fir.ref<!fir.char<1,?>>)
19+
%2 = fir.alloca !fir.char<1> {bindc_name = "local", uniq_name = "_QFtest1Elocal"}
20+
%3:2 = hlfir.declare %2 typeparams %c1 {uniq_name = "_QFtest1Elocal"} : (!fir.ref<!fir.char<1>>, index) -> (!fir.ref<!fir.char<1>>, !fir.ref<!fir.char<1>>)
21+
hlfir.assign %1#0 to %3#0 : !fir.boxchar<1>, !fir.ref<!fir.char<1>>
22+
return
23+
}
24+
}
25+
26+
// -----
27+
28+
// CHECK-LABEL: func.func @_QPtest2
29+
// CHECK: [[C_DECL:%[0-9]*]] = fir.declare{{.*}}{uniq_name = "_QFtest2Ec"} : (!fir.ref<!fir.char<1,?>>, index) -> !fir.ref<!fir.char<1,?>>
30+
// CHECK: [[LOCAL_DECL:%[0-9]*]] = fir.declare{{.*}}{uniq_name = "_QFtest2Elocal"} : (!fir.ref<!fir.char<1>>, index) -> !fir.ref<!fir.char<1>>
31+
// CHECK: [[LD:%[0-9]*]] = fir.load [[LOCAL_DECL]] : !fir.ref<!fir.char<1>>
32+
// CHECK: [[CVT:%[0-9]*]] = fir.convert [[C_DECL]] : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.char<1>>
33+
// CHECK: fir.store [[LD]] to [[CVT]] : !fir.ref<!fir.char<1>>
34+
module {
35+
func.func @_QPtest2(%arg0: !fir.boxchar<1> {fir.bindc_name = "c"}) {
36+
%c1 = arith.constant 1 : index
37+
%0:2 = fir.unboxchar %arg0 : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index)
38+
%1:2 = hlfir.declare %0#0 typeparams %c1 {uniq_name = "_QFtest2Ec"} : (!fir.ref<!fir.char<1,?>>, index) -> (!fir.boxchar<1>, !fir.ref<!fir.char<1,?>>)
39+
%2 = fir.alloca !fir.char<1> {bindc_name = "local", uniq_name = "_QFtest2Elocal"}
40+
%3:2 = hlfir.declare %2 typeparams %c1 {uniq_name = "_QFtest2Elocal"} : (!fir.ref<!fir.char<1>>, index) -> (!fir.ref<!fir.char<1>>, !fir.ref<!fir.char<1>>)
41+
hlfir.assign %3#0 to %1#0 : !fir.ref<!fir.char<1>>, !fir.boxchar<1>
42+
return
43+
}
44+
}

flang/test/Lower/HLFIR/calls-character-singleton-result.f90

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ subroutine scalar_char(c, i)
1111
end subroutine
1212
! CHECK-LABEL: func.func @_QPscalar_char(
1313
! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.char<1>
14-
! CHECK: %[[VAL_5:.*]]:2 = hlfir.declare %{{.*}}#0 typeparams %{{.*}} {{.*}}Ec
14+
! CHECK: %[[VAL_4:.*]] = fir.convert %{{.*}}#0 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.char<1>>
15+
! CHECK: %[[VAL_5:.*]]:2 = hlfir.declare %[[VAL_4]] typeparams %{{.*}} {{.*}}Ec
1516
! CHECK: %[[VAL_6:.*]]:2 = hlfir.declare %{{.*}} {{.*}}Ei
1617
! CHECK: %[[VAL_7:.*]] = fir.load %[[VAL_6]]#1 : !fir.ref<i64>
1718
! CHECK: %[[VAL_8:.*]] = fir.convert %[[VAL_7]] : (i64) -> i8
@@ -20,7 +21,7 @@ subroutine scalar_char(c, i)
2021
! CHECK: fir.store %[[VAL_10]] to %[[VAL_2]] : !fir.ref<!fir.char<1>>
2122
! CHECK: %[[VAL_11:.*]] = arith.constant false
2223
! CHECK: %[[VAL_12:.*]] = hlfir.as_expr %[[VAL_2]] move %[[VAL_11]] : (!fir.ref<!fir.char<1>>, i1) -> !hlfir.expr<!fir.char<1>>
23-
! CHECK: hlfir.assign %[[VAL_12]] to %[[VAL_5]]#0 : !hlfir.expr<!fir.char<1>>, !fir.boxchar<1>
24+
! CHECK: hlfir.assign %[[VAL_12]] to %[[VAL_5]]#0 : !hlfir.expr<!fir.char<1>>, !fir.ref<!fir.char<1>>
2425

2526
subroutine scalar_bindc(c)
2627
character(1) :: c
@@ -32,12 +33,13 @@ character(1) function bar() bind(c)
3233
end subroutine
3334
! CHECK-LABEL: func.func @_QPscalar_bindc(
3435
! CHECK: %[[VAL_1:.*]] = fir.alloca !fir.char<1>
35-
! CHECK: %[[VAL_4:.*]]:2 = hlfir.declare %{{.*}}#0 typeparams %{{.*}} {{.*}}Ec
36+
! CHECK: %[[VAL_3:.*]] = fir.convert %{{.*}}#0 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.char<1>>
37+
! CHECK: %[[VAL_4:.*]]:2 = hlfir.declare %[[VAL_3]] typeparams %{{.*}} {{.*}}Ec
3638
! CHECK: %[[VAL_5:.*]] = fir.call @bar() fastmath<contract> : () -> !fir.char<1>
3739
! CHECK: fir.store %[[VAL_5]] to %[[VAL_1]] : !fir.ref<!fir.char<1>>
3840
! CHECK: %[[VAL_6:.*]] = arith.constant false
3941
! CHECK: %[[VAL_7:.*]] = hlfir.as_expr %[[VAL_1]] move %[[VAL_6]] : (!fir.ref<!fir.char<1>>, i1) -> !hlfir.expr<!fir.char<1>>
40-
! CHECK: hlfir.assign %[[VAL_7]] to %[[VAL_4]]#0 : !hlfir.expr<!fir.char<1>>, !fir.boxchar<1>
42+
! CHECK: hlfir.assign %[[VAL_7]] to %[[VAL_4]]#0 : !hlfir.expr<!fir.char<1>>, !fir.ref<!fir.char<1>>
4143

4244
subroutine array_char(c, i)
4345
character(1) :: c(100)

flang/test/Lower/HLFIR/convert-variable.f90

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ subroutine scalar_character_cst_len(c)
2323
! CHECK-SAME: %[[VAL_0:.*]]: !fir.boxchar<1>
2424
! CHECK: %[[VAL_1:.*]]:2 = fir.unboxchar %[[VAL_0]] : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index)
2525
! CHECK: %[[VAL_2:.*]] = arith.constant 10 : index
26-
! CHECK: %[[VAL_3:.*]] = hlfir.declare %[[VAL_1]]#0 typeparams %[[VAL_2]] {uniq_name = "_QFscalar_character_cst_lenEc"} : (!fir.ref<!fir.char<1,?>>, index) -> (!fir.boxchar<1>, !fir.ref<!fir.char<1,?>>)
26+
! CHECK: %[[VAL_3:.*]] = fir.convert %[[VAL_1]]#0 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.char<1,10>>
27+
! CHECK: %[[VAL_4:.*]] = hlfir.declare %[[VAL_3]] typeparams %[[VAL_2]] {uniq_name = "_QFscalar_character_cst_lenEc"} : (!fir.ref<!fir.char<1,10>>, index) -> (!fir.ref<!fir.char<1,10>>, !fir.ref<!fir.char<1,10>>)
2728

2829
subroutine array_numeric(x)
2930
integer :: x(10, 20)

flang/test/Lower/HLFIR/implicit-call-mismatch.f90

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ subroutine pass_kind2_char_to_char(c)
3737
call takes_char(c)
3838
end subroutine
3939
! CHECK-LABEL: func.func @_QPpass_kind2_char_to_char(
40-
! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare {{.*}}Ec
40+
! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare {{.*}}Ec
41+
! CHECK: %[[VAL_3:.*]] = fir.emboxchar %[[VAL_2]]#1, %{{.*}} : (!fir.ref<!fir.char<2,4>>, index) -> !fir.boxchar<2>
4142
! CHECK: %[[VAL_4:.*]] = fir.address_of(@_QPtakes_char) : (!fir.boxchar<1>) -> ()
4243
! CHECK: %[[VAL_5:.*]] = fir.convert %[[VAL_4]] : ((!fir.boxchar<1>) -> ()) -> ((!fir.boxchar<2>) -> ())
43-
! CHECK: fir.call %[[VAL_5]](%[[VAL_3]]#0) {{.*}}: (!fir.boxchar<2>) -> ()
44+
! CHECK: fir.call %[[VAL_5]](%[[VAL_3]]) {{.*}}: (!fir.boxchar<2>) -> ()
4445

4546
subroutine takes_real(r)
4647
real(8) :: r
@@ -60,10 +61,11 @@ subroutine pass_char_to_real(c)
6061
call takes_real(c)
6162
end subroutine
6263
! CHECK-LABEL: func.func @_QPpass_char_to_real(
63-
! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare {{.*}}Ec
64+
! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare {{.*}}Ec
65+
! CHECK: %[[VAL_3:.*]] = fir.emboxchar %[[VAL_2]]#1, %{{.*}} : (!fir.ref<!fir.char<1,8>>, index) -> !fir.boxchar<1>
6466
! CHECK: %[[VAL_4:.*]] = fir.address_of(@_QPtakes_real) : (!fir.ref<f64>) -> ()
6567
! CHECK: %[[VAL_5:.*]] = fir.convert %[[VAL_4]] : ((!fir.ref<f64>) -> ()) -> ((!fir.boxchar<1>) -> ())
66-
! CHECK: fir.call %[[VAL_5]](%[[VAL_3]]#0) {{.*}}: (!fir.boxchar<1>) -> ()
68+
! CHECK: fir.call %[[VAL_5]](%[[VAL_3]]) {{.*}}: (!fir.boxchar<1>) -> ()
6769

6870
subroutine pass_proc_to_real()
6971
real(8), external :: proc
@@ -105,10 +107,11 @@ subroutine pass_char_to_char_proc(c)
105107
call takes_char_proc(c)
106108
end subroutine
107109
! CHECK-LABEL: func.func @_QPpass_char_to_char_proc(
108-
! CHECK: %[[VAL_3:.*]]:2 = hlfir.declare {{.*}}Ec
110+
! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare {{.*}}Ec
111+
! CHECK: %[[VAL_3:.*]] = fir.emboxchar %[[VAL_2]]#1, %{{.*}} : (!fir.ref<!fir.char<1,8>>, index) -> !fir.boxchar<1>
109112
! CHECK: %[[VAL_4:.*]] = fir.address_of(@_QPtakes_char_proc) : (tuple<!fir.boxproc<() -> ()>, i64>) -> ()
110113
! CHECK: %[[VAL_5:.*]] = fir.convert %[[VAL_4]] : ((tuple<!fir.boxproc<() -> ()>, i64>) -> ()) -> ((!fir.boxchar<1>) -> ())
111-
! CHECK: fir.call %[[VAL_5]](%[[VAL_3]]#0) {{.*}}: (!fir.boxchar<1>) -> ()
114+
! CHECK: fir.call %[[VAL_5]](%[[VAL_3]]) {{.*}}: (!fir.boxchar<1>) -> ()
112115

113116
subroutine takes_proc(proc)
114117
real(8), external :: proc

flang/test/Lower/HLFIR/substrings.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ subroutine cst_len(array, scalar)
2424
! CHECK: %[[VAL_34:.*]] = hlfir.designate %[[VAL_7]]#0 (%[[VAL_15]]:%[[VAL_5]]:%[[VAL_15]]) substr %[[VAL_16]], %[[VAL_3]] shape %[[VAL_6]] typeparams %[[VAL_33]] : (!fir.ref<!fir.array<100x!fir.char<1,10>>>, index, index, index, index, index, !fir.shape<1>, index) -> !fir.box<!fir.array<100x!fir.char<1,9>>>
2525

2626
print *, scalar(2:5)
27-
! CHECK: %[[VAL_40:.*]] = hlfir.designate %[[VAL_9]]#0 substr %[[VAL_16]], %[[VAL_17]] typeparams %[[VAL_18]] : (!fir.boxchar<1>, index, index, index) -> !fir.ref<!fir.char<1,4>>
27+
! CHECK: %[[VAL_40:.*]] = hlfir.designate %[[VAL_9]]#0 substr %[[VAL_16]], %[[VAL_17]] typeparams %[[VAL_18]] : (!fir.ref<!fir.char<1,10>>, index, index, index) -> !fir.ref<!fir.char<1,4>>
2828
end subroutine
2929

3030
! CHECK-LABEL: func.func @_QPdyn_len(

flang/test/Lower/Intrinsics/achar.f90

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
! RUN: bbc -emit-fir %s -o - | fir-opt --canonicalize | FileCheck %s
22
! RUN: %flang_fc1 -emit-fir %s -o - | fir-opt --canonicalize | FileCheck %s
33

4-
! CHECK-LABEL: test1
5-
! CHECK-SAME: (%[[XREF:.*]]: !fir.ref<i32> {{.*}}, %[[CBOX:.*]]: !fir.boxchar<1> {{.*}})
6-
! CHECK-DAG: %[[C1:.*]] = arith.constant 1 : index
7-
! CHECK-DAG: %[[FALSE:.*]] = arith.constant false
8-
! CHECK: %[[TEMP:.*]] = fir.alloca !fir.char<1> {adapt.valuebyref}
9-
! CHECK: %[[C:.*]]:2 = fir.unboxchar %[[CBOX]] : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index)
10-
! CHECK: %[[X:.*]] = fir.load %[[XREF]] : !fir.ref<i32>
11-
! CHECK: %[[X_I8:.*]] = fir.convert %[[X]] : (i32) -> i8
12-
! CHECK: %[[UNDEF:.*]] = fir.undefined !fir.char<1>
13-
! CHECK: %[[XCHAR:.*]] = fir.insert_value %[[UNDEF]], %[[X_I8]], [0 : index] : (!fir.char<1>, i8) -> !fir.char<1>
14-
! CHECK: fir.store %[[XCHAR]] to %[[TEMP]] : !fir.ref<!fir.char<1>>
15-
! CHECK: %[[C1_I64:.*]] = fir.convert %[[C1]] : (index) -> i64
16-
! CHECK: %[[C_CVT:.*]] = fir.convert %[[C]]#0 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<i8>
17-
! CHECK: %[[TEMP_WITH_XCHAR:.*]] = fir.convert %[[TEMP]] : (!fir.ref<!fir.char<1>>) -> !fir.ref<i8>
18-
! CHECK: fir.call @llvm.memmove.p0.p0.i64(%[[C_CVT]], %[[TEMP_WITH_XCHAR]], %[[C1_I64]], %[[FALSE]]) {{.*}}: (!fir.ref<i8>, !fir.ref<i8>, i64, i1) -> ()
4+
5+
! CHECK-LABEL: func.func @_QPtest1(
6+
! CHECK-SAME: %[[VAL_0:.*]]: !fir.ref<i32> {fir.bindc_name = "x"},
7+
! CHECK-SAME: %[[VAL_1:.*]]: !fir.boxchar<1> {fir.bindc_name = "c"}) {
8+
! CHECK: %[[VAL_2:.*]] = fir.alloca !fir.char<1> {adapt.valuebyref}
9+
! CHECK: %[[VAL_3:.*]]:2 = fir.unboxchar %[[VAL_1]] : (!fir.boxchar<1>) -> (!fir.ref<!fir.char<1,?>>, index)
10+
! CHECK: %[[VAL_4:.*]] = fir.convert %[[VAL_3]]#0 : (!fir.ref<!fir.char<1,?>>) -> !fir.ref<!fir.char<1>>
11+
! CHECK: %[[VAL_5:.*]] = fir.load %[[VAL_0]] : !fir.ref<i32>
12+
! CHECK: %[[VAL_6:.*]] = fir.convert %[[VAL_5]] : (i32) -> i8
13+
! CHECK: %[[VAL_7:.*]] = fir.undefined !fir.char<1>
14+
! CHECK: %[[VAL_8:.*]] = fir.insert_value %[[VAL_7]], %[[VAL_6]], [0 : index] : (!fir.char<1>, i8) -> !fir.char<1>
15+
! CHECK: fir.store %[[VAL_8]] to %[[VAL_2]] : !fir.ref<!fir.char<1>>
16+
! CHECK: %[[VAL_9:.*]] = fir.load %[[VAL_2]] : !fir.ref<!fir.char<1>>
17+
! CHECK: fir.store %[[VAL_9]] to %[[VAL_4]] : !fir.ref<!fir.char<1>>
18+
! CHECK: return
19+
! CHECK: }
1920
subroutine test1(x, c)
2021
integer :: x
2122
character :: c

0 commit comments

Comments
 (0)