[PATCH] Fortran: ICE in simplification of array expression involving power [PR107680]

Harald Anlauf anlauf@gmx.de
Tue Nov 15 20:45:04 GMT 2022


Dear all,

when constant expressions involve parentheses, array constructors,
typespecs, and the power operator (**), we could fail with an ICE
during simplification in arith_power.

Debugging of the testcase showed we call the proper type conversions
needed for the arithmetic operation, but under certain circumstances
we seem to lose the typespec on the way to the invocation of the
simplification.  We then run into unhandled combinations of operand
types.

The attached patch is likely a sort of a band-aid to the problem:
we check the operand types in arith_power, and if we see that a
conversion is (still) needed, we punt and defer the simplification.

AFAICT this is safe.  It does not address a possibly deeply
covered issue in gfortran, which was suspected when analyzing
pr107000.  But as this is elusive, that may be hard to locate
and fix.

Regtested on x86_64-pc-linux-gnu.  OK for mainline?

Thanks,
Harald

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr107680.diff
Type: text/x-patch
Size: 3069 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20221115/291a6c4f/attachment.bin>


More information about the Fortran mailing list