[gfortran,patch] Integer constants overflowing type with -fno-range-check

Jerry DeLisle jvdelisle@verizon.net
Thu Mar 22 09:34:00 GMT 2007


François-Xavier Coudert wrote:
> Hi all,
> 
> Attached patch fixes PR31262: when an integer constant overflows its
> type, it can still be accepted if -fno-range-check is used. However,
> the function gfc_conv_mpz_to_tree() in trans-const.c had an assumption
> that constants were always inside their type range.
> 
> This removes the assumption by allowing the integer constant
> arbitrarily large. The patch was regtested on i686-linux, and I will
> commit it with a testcase along the lines of:
> 
>  integer :: a
>  integer(kind=8) :: b
>  a = -3
>  b = -huge(b) / 7
>  a = a ** 73
>  b = 7894_8 * b - 78941_8
>  if ((-3)**73 /= a) call abort()
>  if (7894_8 * (-huge(b) / 7) - 78941_8 /= b) call abort()
>  end
> 
> OK for mainline? It's not a regression, so I won't backport it to 4.2
> unless someone feels strongly about it.
> 

This is OK for Trunk.  I would stay away from 4.2 for a while.  We need to 
stabilize it.

Jerry



More information about the Gcc-patches mailing list