[fortran, patch] PR32001 - ICE in min/max intrinsics with multiple arguments

Daniel Franke franke.daniel@gmail.com
Sun May 20 09:19:00 GMT 2007


MIN/MAX intrinsics allow multiple arguments which the associated checking 
routine gets provided in an 'gfc_actual_arglist' and not, as usual, in a 
global array of fixed size. To assemble the error message, the latter was 
used, which may result in an ICE if the number of arguments to MIN/MAX is 
larger than the array size.

In addition, the code compared each argument against the first one only. Thus 
code like this would not be flagged:

INTEGER :: a, b(2), c(3), res(3)
res = max(a, b, c)

Although SHAPE(c) /= SHAPE(C), B and C are conform with A respectively. 
Attached patch fixes both problems.


gcc/fortran:
2007-05-19  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/32001
	* check.c (check_rest): Improved argument conformance check and fixed 
	error message generation.


gcc/testsuite:
2007-05-19  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/32001
	* min_max_conformance.f90: Added more testcases.


Richard confirmed in private mail that the patch fixes the problem in 
SPEC2k/fma3d and it regtested cleanly on i686-pc-linux-gnu. Ok for trunk?

	Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: minmax.patch
Type: text/x-diff
Size: 3423 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070520/6502c999/attachment.bin>


More information about the Fortran mailing list