diff options
author | Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2007-08-29 15:22:55 +0000 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2007-08-29 15:22:55 +0000 |
commit | ed8315d5fcd7a86afc791a2643ef329aa599b2f5 (patch) | |
tree | 774547a136c573b57623fceaa8560b1cbbe1cd1b /gcc/fortran/check.c | |
parent | c3f07bd6a09f916ff4497db5b7675b5891a5627d (diff) | |
download | gcc-ed8315d5fcd7a86afc791a2643ef329aa599b2f5.zip gcc-ed8315d5fcd7a86afc791a2643ef329aa599b2f5.tar.gz gcc-ed8315d5fcd7a86afc791a2643ef329aa599b2f5.tar.bz2 |
re PR libfortran/32989 (GETARG intrinsic)
PR fortran/32989
* iresolve.c (gfc_resolve_getarg): Handle non-default integer
kinds.
* check.c (gfc_check_getarg): New function
* intrinsic.h: Add prototype for gfc_check_getarg.
* intrinsic.c (add_subroutines): Add reference to gfc_check_getarg.
* intrinsic.texi (GETARG): Adjust documentation.
* gfortran.fortran-torture/execute/getarg_1.f90: Add check for
non-default integer kind arguments.
From-SVN: r127905
Diffstat (limited to 'gcc/fortran/check.c')
-rw-r--r-- | gcc/fortran/check.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index 634d6b4..ed824fe 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -3234,6 +3234,28 @@ gfc_check_getcwd_sub (gfc_expr *cwd, gfc_expr *status) try +gfc_check_getarg (gfc_expr *pos, gfc_expr *value) +{ + if (type_check (pos, 0, BT_INTEGER) == FAILURE) + return FAILURE; + + if (pos->ts.kind > gfc_default_integer_kind) + { + gfc_error ("'%s' argument of '%s' intrinsic at %L must be of a kind " + "not wider than the default kind (%d)", + gfc_current_intrinsic_arg[0], gfc_current_intrinsic, + &pos->where, gfc_default_integer_kind); + return FAILURE; + } + + if (type_check (value, 1, BT_CHARACTER) == FAILURE) + return FAILURE; + + return SUCCESS; +} + + +try gfc_check_getlog (gfc_expr *msg) { if (type_check (msg, 0, BT_CHARACTER) == FAILURE) |