Re: Merseene Twister -- A New Fortran 95 Implementation

From: Steven G. Kargl (kargl_at_x1-6-00-00-c5-b3-45-24.client.attbi.com)
Date: 01/06/04


Date: Tue, 06 Jan 2004 16:57:49 GMT

In article <m3fzeue5fu.fsf@altair.dfrc.nasa.gov>,
        Richard Maine <nospam@see.signature> writes:
> Scott Robert Ladd <scott@coyotegulch.com> writes:
>
>> Then I involved myself in the GNU gfortran project; gfortran rejected
>> -2147483648 as invalid. Indeed, the "free-as-in-liberty" compiler was
>> correct, using a strict interpretation of the Fortran 95 Standard (section
>> 13.7, to be precise).
>
> Nope. I maintain that this is a *MIS*interpretation of the section.
> And this is the one compiler in development that I was talking
> about.

I've read chapters 4 and 13 of the draft standard and I cannot locate
where the standard states that a machine number, which is not a
member of model numbers, must be permitted by a conforming Fortran
processor. Based on your following paragraph, I don't see how you
can claim it is a *MIS*interpretation of the standard. gfortran
is limiting the default integer kind (on a 32-bit processor) to
[-2**31-1:2**31-1]. Your following paragraph suggests that gfortran
is a conforming processor.

> True, the standard doesn't require that the number in question be
> a valid integer value. But the standard also doesn't require that
> +12345 be a valid integer value. The compiler is quite free to
> limit integers to a range of -11111 to +12344, and to take 32-bits
> to store such integers. Seems a bit strange, but it is allowed.
> The compiler is also free to disallow -2147483648 as an integer
> value, but the standard no more demands this than it demands that
> integers be limited to the range of -11111 to +12344.
>
> I think that it is just broken for the compiler to disallow this.
> And if it doesn't get fixed someday, I expect lots of complaints.
> I don't think it does anyone a service to interpret the standard
> like this.

I'm curious Richard, what does your suite of F90/95 compilers
do with the following program.

program a
  integer :: i = -2147483647 ! non-portable code
  i = i - 1
  print *, abs(i) ! -2147483648 is not a model number.
end program a

By limiting INTEGER to the model numbers, gfortran can have
an optimized ABS() function; otherwise the compiler/run-time
library should/would need to check for a range error in ABS().

-- 
Steve


Relevant Pages

  • Re: Is C99 the final C? (some suggestions)
    ... > that someone will try compile their stuff on an old compiler. ... > because the ANSI standard obsoleted them, and everyone picked up the ANSI ... fixed by using another language. ... >>are multiplying two expressions of the widest type supported by your ...
    (comp.lang.c)
  • Re: Statement on Schildt submitted to wikipedia today
    ... to working programmers and more with being "right all the time, ... so that compiler developers could be shed ... The major corporate interests were compiler developers, ... processors, committed to standard division semantics, and otherwise ...
    (comp.lang.c.moderated)
  • Re: #define and (brackets)
    ... Minor compiler vendors are free to join if they are so inclined, ... analysis hasn't changed between the two versions of the standard. ... This bug is a minor bug in an obscure ...
    (microsoft.public.vc.language)
  • Re: interesting use of NEXT SENTENCE vs. CONTINUE
    ... Program name in quotes (allowed in '02 Standard) ... > If J can be made an independent item which the compiler can put wherever it ... > has to be associated with a hardware device in SPECIAL-NAMES. ... > that ALTER *always* modifies the address parameter of the hardware branch ...
    (comp.lang.cobol)
  • Re: interesting use of NEXT SENTENCE vs. CONTINUE
    ... These days I don't do compiler maintenance, but I HAVE done in the past, so ... You had a chance to point out how adherence to the standard can improve ... >> compile it WITH MINOR MODIFICATIONS for a specific platform. ... > platform-specific extension to COBOL ...
    (comp.lang.cobol)