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: [PATCH] New option to support asymmetric integer ranges in gfortran


Steve Kargl wrote:
What is the behavior the following program with your switch?

program parambug
   implicit none
   integer, parameter :: MY_KIND  = SELECTED_INT_KIND(9)
   integer(MY_KIND), parameter :: X = -2147483648_MY_KIND
   write (*,*) X,",",MY_KIND
   write (*,*) ABS(X)
end program parambug

Compiled with my flag, your program prints:


 -2147483648 ,            4
 -2147483648

Clearly, a wrong answer -- but it is the *same* wrong answer displayed by Intel and Lahey. And translating the code to C for compilation with gcc produces the same result.

Being a non-conformist by nature, a voice in the back of my head says: "Damn compatibility!" But I know in my heart of hearts that gfortran's correctness is a potential problem in a world populated by less-than-perfect compilers and languages. So I think that a flag that enables "bad" behavior is appropriate, for situations where one must interact with others.

I should bring this up on comp.lang.fortran to see what the general community thinks of all this.

--
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]