[patch, fortran] Add _gfortran_error_stop_numeric
Jerry DeLisle
jvdelisle@verizon.net
Fri May 14 03:53:00 GMT 2010
On 05/08/2010 01:10 PM, Jerry DeLisle wrote:
> Hi all,
>
> The attached patch adds this run-time function.
>
I decided to go ahead and incorporate some additional changes. The attached
patch uses the NULL expression to signal that the STOP, ERROR STOP, or PAUSE
statements are empty. I pass a flag to the run-time functions to signal the
library this condition rather than use the -1 stop code. This allows a program
to actually use a -1 stop code.
I also pass to the runtime a kind=8 integer for the integer stop code to allow
-fdefault-integer-8 to work with no problems. I chose to not go larger than
this since most if not all systems can not use large values regardless.
The statements now match constant expressions and I have added checks to
generate errors if non-integer, non-character, or not constant expressions are
given. I got rid of the old digit counting matcher. Seemed pointless since we
now accept expressions.
The empty ERROR STOP issues a 1 exit code. The PAUSE run-time was updated since
it uses the gfc_match_stopcode function. PAUSE is a "deleted" feature and it now
takes an expression. (A two for one deal)
Regression tested on x86_64.
OK for trunk?
Jerry
2010-05-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/43851
* runtime/stop.c (error_stop_numeric): Update comment and add new
function. (stop_numeric): Modify function to accept a flag to indicate
an empty stop statement. Add missing attribute noreturn.
* runtime/pause.c (do_pause): Likewise. (pause_numeric): Likewise.
* gfortran.map: Add new symbol _gfortran_error_stop_numeric to
run-time library.
* libgfortran.h: Revise declaration for stop_numeric.
2010-05-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/43851
* trans-stmt.c (gfc_trans_stop): Add generation of call to
gfortran_error_stop_numeric. Fix up some whitespace. Modify the call
creation to include a new parameter to signal an empty stop. Use kind 8
integer types to allow -fdefault-integer-8 to work. Use the constant
expression. (gfc_trans_pause): Likewise.
* trans.h: Add external function declaration for error_stop_numeric.
* trans-decl.c (gfc_build_builtin_function_decls): Add the building of
the declaration for the library call. Fix whitespaces
* match.c (gfc_match_stopcode): Remove use of the actual stop code to
signal no stop code. Match the expression following the stop and pass
that to the translators. Remove the old use of digit matching. Add
checks that the stop_code expression is INTEGER or CHARACTER and also
a constant expression.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr43851.diff
Type: text/x-patch
Size: 11533 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100514/c963d01b/attachment.bin>
More information about the Gcc-patches
mailing list