[patch, fortran] fixes for the EXIT intrinsic function (PR30933)
Tobias Burnus
burnus@net-b.de
Fri Feb 23 18:03:00 GMT 2007
:ADDPATCH fortran:
The following patch does the following
a) Correct the dummy argument name; for "exit(status)" (is was "code"
instead of "status") and for "new_line(A)" (it was "i").
b) It allows any integer kind for the exit subroutine. This is in the
spirit of Fortran 2003 which also allows any kind for most of the
intrinsic procedures. Status quo is to give a link-time error that
exit_i1 etc. does not exist.
For (b) there are several options:
i. Add i1, i2, and i16 versions to libgfortran
ii. Convert kind > 8 to integer(8) and kind < 4 to integer(4)
iii. As POSIX defines "exit(int)" and sizeof(int) is on most systems "4"
convert everything to integer(4)
iv. Convert everything to the default integer, i.e. integer(4) or
integer(8) depending whether -fdefault-integer-8 is used.
I have chosen i, but I don't know which is the best, cleanest and most
sensible choice. For option ii, I would really like to have INTEGER_4
defined in gcc/fortran/* as otherwise one has to work with magic
numbers: "if (kind < 4)".
(Option iii would change the ABI of the library - at least exit_i8 would
cease to exist.)
Build & regression tested on x86_64-unknown-linux-gnu.
Ok for the trunk and 4.2?
Tobias
PS: Thanks to Daniel Franke for finding the two bugs.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: exit.diff
Type: text/x-patch
Size: 4463 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070223/64e4f1e5/attachment.bin>
More information about the Fortran
mailing list