aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/iresolve.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/iresolve.c')
-rw-r--r--gcc/fortran/iresolve.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
index d029f720..f9a69fe 100644
--- a/gcc/fortran/iresolve.c
+++ b/gcc/fortran/iresolve.c
@@ -3293,13 +3293,14 @@ gfc_resolve_system_clock (gfc_code *c)
{
const char *name;
int kind;
-
- if (c->ext.actual->expr != NULL)
- kind = c->ext.actual->expr->ts.kind;
- else if (c->ext.actual->next->expr != NULL)
- kind = c->ext.actual->next->expr->ts.kind;
- else if (c->ext.actual->next->next->expr != NULL)
- kind = c->ext.actual->next->next->expr->ts.kind;
+ gfc_expr *count = c->ext.actual->expr;
+ gfc_expr *count_max = c->ext.actual->next->next->expr;
+
+ /* The INTEGER(8) version has higher precision, it is used if both COUNT
+ and COUNT_MAX can hold 64-bit values, or are absent. */
+ if ((!count || count->ts.kind >= 8)
+ && (!count_max || count_max->ts.kind >= 8))
+ kind = 8;
else
kind = gfc_default_integer_kind;