[patch, fortran] Fix PR 91541, ICE on valid for INDEX

Thomas Koenig tkoenig@netcologne.de
Thu Dec 19 07:42:00 GMT 2019


Hello world,

the attached patch fixes an ICE on valid for INDEX (see test case).
The problem was that the KIND argument was still present during
scalarization, which caused the ICE.

The fix is to remove the KIND argument, and the best place
to do this is in resolution.  I did try to do this in
gfc_conv_intrinsic_index_scan_verify, but it is too late by then.

Removing the KIND argument required changing the call signature
of gfc_resolve_index_func, which in turn required the rest of
the changes (including the one in trans-decl.c - I am not convinced
that what we are doing there is right, but for this bug fix, I
left the functionality as is).

Regression-tested. OK for trunk?

Regards

	Thomas

2019-12-19  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/91541
	* intrinsic.c (add_sym_4ind): New function.
	(add_functions): Use it for INDEX.
	(resolve_intrinsic): Also call f1m for INDEX.
	* intrinsic.h (gfc_resolve_index_func): Adjust prototype to
	take a gfc_arglist instead of individual arguments.
	* iresolve.c (gfc_resolve_index_func): Adjust arguments.
	Remove KIND argument if present, and make sure this is
	not done twice.
	* trans-decl.c: Include "intrinsic.h".
	(gfc_get_extern_function_decl): Special case for resolving INDEX.

2019-12-19  Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/91541
	* gfortran.dg/index_3.f90: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p3a.diff
Type: text/x-patch
Size: 6217 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20191219/45a5fe77/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: index_3.f90
Type: text/x-fortran
Size: 217 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20191219/45a5fe77/attachment-0001.bin>


More information about the Gcc-patches mailing list