summaryrefslogtreecommitdiff
path: root/libgfortran/intrinsics/rand.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/intrinsics/rand.c')
-rw-r--r--libgfortran/intrinsics/rand.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libgfortran/intrinsics/rand.c b/libgfortran/intrinsics/rand.c
index d59e1688371..f4e78d0470e 100644
--- a/libgfortran/intrinsics/rand.c
+++ b/libgfortran/intrinsics/rand.c
@@ -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)
{