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 Fri, Sep 08, 2006 at 09:09:15AM -0700, H. J. Lu wrote:
> On Fri, Sep 08, 2006 at 07:16:23AM -0700, Steve Kargl wrote:
>> On Fri, Sep 08, 2006 at 03:27:00AM -0400, Jakub Jelinek wrote:
>>> On Fri, Sep 08, 2006 at 12:20:15AM -0700, Brooks Moses wrote:
>>>>>This can't be right.  The test really needs an integer with all bits set,
>>>>>-huge(x) - 1 is Z'80000000'.  That's what the OpenMP standard mandates
>>>>>that iand reduction var should be initialized to.
>>>> 
>>>> Indeed.  This should be x=-1.  Or, possibly more clearly, x=not(0).
>>> 
>>> Well, -1 only if you know it is two's complement, I believe Fortran standard
>>> doesn't mandate that.  So not(0), but won't the FE do the compile time range
>>> checking on it?  I.e. don't we have to write
>>> x = 0
>>> x = not(x)
>> 
>> The frontend may optimize the above, but it should be legal
>> to do not(0) as long as -huge()-1 <= not <= huge().  If not,
>> you can do it the hard way
>> 
>>   integer i, x
>>   x = 0
>>   do i = 1, bit_size(x)
>>      x = ibset(x,i)
>>   end do
>> 
>> BTW, does gcc run on any non-twos-complement hardware?
>> 
> 
> Can't we just use (-2147483647 - 1)?
> 

Read the thread starting at Jakub's post.  I replaced
a BOZ constant of the form Z'FFFFFFFFF' with -huge(x)-1
(which is equivalent to your suggestion).  Jakub pointed
out that I made my change in haste in that -huge(x)-1
is Z'80000000'.

-- 
Steve


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