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, fortran] Add _gfortran_error_stop_numeric


On 05/09/2010 10:09 AM, Janne Blomqvist wrote:
On Sun, May 9, 2010 at 19:20, Jerry DeLisle<jvdelisle@verizon.net> wrote:
I will change it to zero for ERROR STOP

FWIW, I agree with your later mail and Tobias that in this case we are better of ignoring the standard recommendation and keeping the non-zero exit code for ERROR STOP.

The stop code is scalar-int-constant-expr. Currently:

Hmm, my understanding is that scalar-int-constant-expr means that it must be a literal or a named constant (there's a separate "(signed)-int-literal-constant" for stuff that must be a literal)? E.g. the following ought to be allowed:

program stoptest
   implicit none
   integer, parameter :: i = -1
   stop i
end program stoptest

pr43851.f90:10.16:

  stop 9223372036854775807
                1
Error: Integer too large at (1)

However, I think a 32 bit integer is more that adequate for now. We do not
allow negative codes either.

Absolutely, especially considering POSIX masks out all but the 8 least significant bits anyway, so the possible return codes are between 0 and 256 in any case.

However, in case my reasoning above is correct, we should allow 8 byte
integers due to -fdefault-integer-8 (my preferred solution to this
would be to typecast in the frontend, as I previously mentioned), and
also negative values.


Interestingly, Fortran 95 defines the code as digit [ digit [ digit [ digit [ digit ] ] ] ] with no sign. I think for the short run, I will commit the patch as is, which should satisfy about 99% of the real need. We will have to do some front-end exercises to change to the new standard. (This will give me time to think about what a scalar-int-constant-expr really is!) ;)


Thanks for comments,

Jerry


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