Unverified Commit c0cb8f73 authored by jeanPerier's avatar jeanPerier Committed by GitHub
Browse files

[flang] Fix character function call bug (#67973)

Fixes https://github.com/llvm/llvm-project/issues/67658

The bug was that when instantiating a character array result variable,
the code inserted a cast from the result buffer to the proper array type
if it could see an fir.unboxchar op. But this is wrong for results and
on caller side because the fir.emboxchar is visible so,
charHelper.genUnboxChar() just takes the operand from that instead of
generating an unboxchar.

The fix is simply to move the cast at the place where fir.boxchar<>
argument are dealt with. The cast when creating fir.emboxchar is also
removed: it adds noise and causes constant length result type to be
lowered to fir.char<?>.

The main change from this patch is to deal with the lit test fallout of
this cast move and removal.
parent 0e8f924f
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment