@@ -276,38 +276,7 @@ class ExprLowering {
276
276
fir::ExtendedValue genLoad (const fir::ExtendedValue &addr) {
277
277
auto loc = getLoc ();
278
278
return addr.match (
279
- [&](const fir::CharBoxValue &box) -> fir::ExtendedValue {
280
- auto buffer = box.getBuffer ();
281
- auto len = dyn_cast<mlir::ConstantOp>(box.getLen ().getDefiningOp ());
282
- if (!len) {
283
- // TODO: return an emboxchar?
284
- // Not sure an emboxchar would help, it would simply
285
- // indirects the memory reference, so it fakes the load and then
286
- // makes it harder to work with the character due to the
287
- // indirection. Solutions I see are:
288
- // 1. create a temp and returns a CharBoxValue pointing to it.
289
- // 2. create a dynamic vector fir type that can abstract 1.
290
- mlir::emitError (loc, " cannot load a variable length char" );
291
- return {};
292
- }
293
- auto lenAttr = len.value ().dyn_cast <mlir::IntegerAttr>();
294
- if (!lenAttr) {
295
- mlir::emitError (loc, " length must be integer" );
296
- return {};
297
- }
298
- auto lenConst = lenAttr.getValue ().getSExtValue ();
299
- fir::SequenceType::Shape shape = {lenConst};
300
- auto baseTy =
301
- Fortran::lower::CharacterExprHelper::getCharacterType (box);
302
- auto charTy =
303
- builder.getRefType (fir::SequenceType::get (shape, baseTy));
304
- auto casted = builder.createConvert (loc, charTy, buffer);
305
- auto val = builder.create <fir::LoadOp>(loc, casted);
306
- return fir::CharBoxValue{val, box.getLen ()};
307
- },
308
- [&](const fir::CharArrayBoxValue &v) -> fir::ExtendedValue {
309
- TODO (" loading character array" );
310
- },
279
+ [](const fir::CharBoxValue &box) -> fir::ExtendedValue { return box; },
311
280
[&](const fir::UnboxedValue &v) -> fir::ExtendedValue {
312
281
return builder.create <fir::LoadOp>(loc, fir::getBase (v));
313
282
},
0 commit comments