Commit 7a003d8e by Canqun Yang Committed by Paul Brook

check.c (gfc_check_rand): Allow missing optional argument.

2004-10-30  Canqun Yang  <canqun@nudt.edu.cn>

	* 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
parent cbb1cada
2004-10-30 Canqun Yang <canqun@nudt.edu.cn>
* 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 <scott.ladd@coyotegulch.com>
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
......
......@@ -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;
......
......@@ -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
......
2004-10-30 Canqun Yang <canqun@nudt.edu.cn>
* intrinsics/rand.c (irand): Handle NULL argument.
2004-10-07 Paul Brook <paul@codesourcery.com>
* io/transfer.c (finalize_transfer): Free internal streams.
......
......@@ -51,7 +51,11 @@ GFC_INTEGER_4
prefix(irand) (GFC_INTEGER_4 *i)
{
GFC_INTEGER_4 j = *i;
GFC_INTEGER_4 j;
if (i)
j = *i;
else
j = 0;
switch (j)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment