This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix libgomp Fortran tests


On Thu, Sep 07, 2006 at 09:42:32PM -0700, Jerry DeLisle wrote:
> Andrew Pinski wrote:
> >There was some previous discussion about this problem in:
> >http://gcc.gnu.org/ml/fortran/2003-12/msg00095.html
> >
> >I forgot what the outcome of the discussion was.
> >
> >Thanks,
> >Andrew Pinski
> >
> Andrew,
> 
> This is a very interesting thread to read and brings up some old arguments. 
> I would like to put in my two cents worth.  The thread discusses 
> consequences of the ABS() intrinsic.

It's more than just abs().  It is technically illegal to do

i = - huge() - 1
call foo(i)      ! foo is compiled into some library

subroutine foo(i)
  i = -i
end subroutine

> If gfortran were to support asymmetrical integers then the ABS intrinsic 
> should throw a runtime error on ABS(most_negative_value).  It does not 
> follow common sense or good reasoning to have an incorrect result and to do 
> so knowingly.
> 
> To avoid the runtime penalty in computations of checking for that absurd 
> case, I think its better to just not allow it and stick with the standard 
> which defines symmetrical integers.


The above is an enormous runtime penalty because you will
need to range check every single operation.  Note the range
checking that I'm fixing is the constant folding in
only the front end.  During runtime you will get the usual 
overflow wrap-around (again, twos compliment).

-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]