Simplification and a zero sized array

Steve Kargl sgk@troutmask.apl.washington.edu
Sat Mar 3 02:02:00 GMT 2018


All,

I would like to commit the attach patch, which fixes
a number of ICE's when simplification runs into a
size zero array.  gfortran does not have a nice
easy way to determine if an array is size zero.  Thus,
the new function is_size_zero_array was written after
staring at several gdb sessions.

This patch does not fix all of the problems with 
size zero arrays:

1) findloc isn't implemented, so obviously it's not fixed.
2) I skipped looking at minloc and maxloc.  These will take
   more effort.
3) I skipped looking at associated.  There are special
   conditions with size zero arrays mentioned, but I
   haven't tried to cause an ICE, yet.
4) The pad dummy argument to the spread has special condition
   when she is size zero.  I haven't tried to cause an
   ICE, yet.

5) minval and maxval can take a size zero array of strings.
   The requirements will call for someone with widechar
   gfortran hacking experience to fix.  At the moment, 
   gfortran will issue an error and die.  So, anyone game
   in handling the widechar stuff?

6) I haven't looked at any of the old g77 compatibility 
   functions.  These may (or may not!) have issues.

Regression tested on x86_64-*-freebsd.  OK to commit?


2018-03-02  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/66128
	* simplify.c (is_size_zero_array): New function to check for size
	zero array.
	(gfc_simplify_all, gfc_simplify_any, gfc_simplify_count, 
	 gfc_simplify_iall, gfc_simplify_iany, gfc_simplify_iparity,
	 gfc_simplify_minval, gfc_simplify_maxval, gfc_simplify_norm2,
	 gfc_simplify_product, gfc_simplify_sum): Use it, and implement
	requirements from F2018.

2018-03-02  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/66128

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



-- 
Steve
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zero_sized.diff
Type: text/x-diff
Size: 9822 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20180303/deb3b1f1/attachment.bin>


More information about the Fortran mailing list