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


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1



Scott Robert Ladd wrote:
| Section 13.7.1 of ISO/IEC 1539-1 ("Fortran 95") specifies that integers
| be symmetrical around zero. For example, in terms of an 8-bit integer,

I finally checked this again, and this is not true. 13.7. says:

"The numeric manipulation and inquiry functions are described in terms
of a model for the representation and behavior of numbers on a
processor. The model has parameters which are determinded so as to make
the model best fit the machine on which the program is executed."

This clause only applies to the definition of the intrinsics, for values
which cannot be represented inside the model, they are undefined.

There is another restriction in 13.14.:

"... A program is prohibited from invoking an intrinsic procedure under
circumstances where a value to be returned in a subroutine argument or
function result is outside the range of values representable by objects
of the specified type and type parameters."

This would apply to Steve's example ABS(-2,som,eth,ing), which shows a
pathology of two's complement numbers. I dont think this is anything the
compiler could catch in a general program.

In my opinion gfortran shouldn't need the command-line option but rather
accept -2**31, and if anybody feels it's worth it catch ABS((-1)*2**31)
when simplifying the intrinsic function.

Just my 0.02¬ of course.

- - Tobi
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1-nr1 (Windows 2000)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE/7IpxRFv08TP0Y+sRArcfAKDfpv0HeWITSEeqh8dLWoSlHxKIqACg/JGQ
0pmrmYYE1O1S5U29guDudwg=
=r1XK
-----END PGP SIGNATURE-----


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