From 7a003d8e2e5f20fab390c2e2988e1c630cbb3ba9 Mon Sep 17 00:00:00 2001 From: Canqun Yang Date: Sat, 30 Oct 2004 14:18:34 +0000 Subject: check.c (gfc_check_rand): Allow missing optional argument. 2004-10-30 Canqun Yang * check.c (gfc_check_rand): Allow missing optional argument. (gfc_check_irand): Ditto. * intrinsic.c (add_functions): Set arg optional flag for {i,}rand. libgfortran/ * intrinsics/rand.c (irand): Handle NULL argument. From-SVN: r89886 --- gcc/fortran/ChangeLog | 8 +++++++- gcc/fortran/check.c | 6 ++++++ gcc/fortran/intrinsic.c | 4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'gcc') diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 676a50f..c950f8c 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,9 +1,15 @@ +2004-10-30 Canqun Yang + + * check.c (gfc_check_rand): Allow missing optional argument. + (gfc_check_irand): Ditto. + * intrinsic.c (add_functions): Set arg optional flag for {i,}rand. + 2004-10-28 Scott Robert Ladd PR fortran/13490, PR fortran/17912 * gcc/fortran/gfortran.h: Added pedantic_min_int to gfc_integer_info * gcc/fortran/gfortran.h: Added ARITH_ASYMMETRIC to arith - * gcc/fortran/arith.c: Added support for an "asymmetric integer" + * gcc/fortran/arith.c: Added support for an "asymmetric integer" warning when compiling with pedantic. * gcc/fortran/arith.c: Set minimum integer values to reflect realities of two's complement signed integers. Added diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index a22acf0..b8ed5e9 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -2001,6 +2001,9 @@ gfc_check_system_clock (gfc_expr * count, gfc_expr * count_rate, try gfc_check_irand (gfc_expr * x) { + if (x == NULL) + return SUCCESS; + if (scalar_check (x, 0) == FAILURE) return FAILURE; @@ -2016,6 +2019,9 @@ gfc_check_irand (gfc_expr * x) try gfc_check_rand (gfc_expr * x) { + if (x == NULL) + return SUCCESS; + if (scalar_check (x, 0) == FAILURE) return FAILURE; diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index aa358f07..bc69f54 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -1307,7 +1307,7 @@ add_functions (void) /* The following function is for G77 compatibility. */ add_sym_1 ("irand", 0, 1, BT_INTEGER, 4, gfc_check_irand, NULL, NULL, - i, BT_INTEGER, 4, 0); + i, BT_INTEGER, 4, 1); make_generic ("irand", GFC_ISYM_IRAND); @@ -1602,7 +1602,7 @@ add_functions (void) /* The following function is for G77 compatibility. */ add_sym_1 ("rand", 0, 1, BT_REAL, 4, gfc_check_rand, NULL, NULL, - i, BT_INTEGER, 4, 0); + i, BT_INTEGER, 4, 1); /* Compatibility with HP FORTRAN 77/iX Reference. Note, rand() and ran() use slightly different shoddy multiplicative congruential -- cgit v1.1