[PATCH] PR fortran/96711 - ICE on NINT() Function

Harald Anlauf anlauf@gmx.de
Mon Aug 24 21:08:40 GMT 2020


When rounding a real to integer(16) an ICE happened due to an unhandled
case in build_round_expr.  The attached patch add a special case for this.

I had to change a fold_convert to a convert (which seems to be frontend
specific stuff), otherwise I would get errors from the generated GIMPLE.
Does anybody know if this could produce problems elsewhere?
I'm open to other / better solutions.

Anyway, the patch does regtest cleanly on x86_64-pc-linux-gnu.

OK for master?

Thanks,
Harald


PR fortran/96711 - ICE with NINT() for integer(16) result

When rounding a real to the nearest integer, temporarily convert the real
argument to a longer real kind when the result is of type/kind integer(16).

gcc/fortran/ChangeLog:

	* trans-intrinsic.c (build_round_expr): Use temporary with
	appropriate kind for conversion before rounding to nearest
	integer when the result precision is 128 bits.

gcc/testsuite/ChangeLog:

	* gfortran.dg/pr96711.f90: New test.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr96711.patch
Type: text/x-patch
Size: 1812 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20200824/2776bc8f/attachment.bin>


More information about the Fortran mailing list