diff options
Diffstat (limited to 'gcc/fortran/check.c')
-rw-r--r-- | gcc/fortran/check.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index f31ad68..677209e 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -4530,7 +4530,9 @@ gfc_check_present (gfc_expr *a) return false; } - if (!sym->attr.optional) + /* For CLASS, the optional attribute might be set at either location. */ + if ((sym->ts.type != BT_CLASS || !CLASS_DATA (sym)->attr.optional) + && !sym->attr.optional) { gfc_error ("%qs argument of %qs intrinsic at %L must be of " "an OPTIONAL dummy variable", |