[PATCH] fortran/36239

Steve Kargl sgk@troutmask.apl.washington.edu
Thu May 15 19:43:00 GMT 2008


The attached patch fixes the ICE-on-valid code in PR 36239.
In gfc_simplify_int(), if the argument to INT() is a complex
constant, and the kind is 1, 2, or 16, you get an ICE.  The
fix involves replacing the hand-rolled integer conversion
in gfc_simplify_int() by use of gfc_complex2int() found in
arith.c.  While I was here, I also updated this simplification
function to use gfc_real2int and gfc_int2int, and I performed
the same surgery on gfc_simplify_intconv().  Finally, note
that gfc_simplify_intconv() has been renamed to simplify_intconv
in that static functions do not carry the gfc_ prefix.

Regression testing showed

                === gfortran Summary ===

# of expected passes            25275
# of unexpected failures        8      <-- Due to Janne's stream surgery
# of unexpected successes       31
# of expected failures          20
# of unsupported tests          34
/usr/home/sgk/gcc/obj4x/gcc/testsuite/gfortran/../../gfortran
version 4.4.0 20080515 (experimental) (GCC) 

I no longer have commit access to the svn repository, so someone will
need to commit the patch.

2008-05-15  Steven G. Kargl  <kargls@comcast.net>

	PR fortran/36239
	* gfortran.dg/int_3.f90

	* simplify.c (gfc_simplify_int, gfc_simplify_intconv): Replaced hand
	rolled integer conversion with gfc_int2int, gfc_real2int, and
	gfc_complex2int.
	(gfc_simplify_intconv): Renamed to simplify_intconv.
	
-- 
Steve
-------------- next part --------------
! { dg-do compile }
subroutine bug1
  integer, parameter :: ik1 = 1, ik2 = 2
  integer, parameter :: i = kind(int((0.,0.), kind=ik1))
  integer, parameter :: j = kind(int((0.,0.), kind=ik2))
  integer, parameter :: k = kind(int(0.,      kind=ik1))
  integer, parameter :: l = kind(int(0.,      kind=ik2))
  integer, parameter :: m = kind(int(0,       kind=ik1))
  integer, parameter :: n = kind(int(0,       kind=ik2))
end subroutine bug1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr36239.diff
Type: text/x-diff
Size: 3217 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20080515/ab6cfcde/attachment.bin>


More information about the Fortran mailing list