This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: [PATCH] New option to support asymmetric integer ranges in gfortran


Tobias Schlüter wrote:
So what you're suggesting is that integer ABS should explicitly compare
its argument against -2**31 everytime it's called? I think that's a
really bad idea.

Well then, we're back to one of two situations:


1) Have the compiler allow -2**31 as a constant, even though some (but not all) Fortraners think this violates the Standard.

2) Have the compiler reject -2**31 as a constant, as it does now.

Under option 2, we have two choices:

a) Reject compatibility with compilers and languages that allow -2**31

  b) Implement the switch from my patch, which allows a programmer to
     explicitly say "ignore the standard" for the sake of
     interoperability.

As we move toward Fortran 2003, we'll need to consider whether an integer(C_INT32_t) allows -2**31, given that such a value *is* valid in Standard C.

If the compiler can detect something like this, have it issue an error.
Otherwise, don't hurt the people that don't do such things. If someone
thinks that this is an error that should be caught by the library, one
can add a compiler flag that makes it link against a library with
complete error checking. But this should by no means be the default
behavior.

I still think my original solution (the -fasymmetric-integers switch) works just fine. It allows gfortran to follow a strict interpretation of the standard, while allowing those who need it to use constants like -2**31. No one gets hurt, no overhead is imposed on anyone, and we can all happily compute our way to happiness.


Or somethign like that. ;)

--
Scott Robert Ladd
Coyote Gulch Productions (http://www.coyotegulch.com)
Software Invention for High-Performance Computing



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