diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2021-10-18 09:49:05 +0200 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2021-10-18 09:49:05 +0200 |
commit | 017665f63047ce47b087b0b283548a60e5abf3d2 (patch) | |
tree | 5403224f6c3336a461883cb8719614f9fac07c20 /gcc/fortran/intrinsic.c | |
parent | f5b37435968bc76498481177593121d238f854fb (diff) | |
download | gcc-017665f63047ce47b087b0b283548a60e5abf3d2.zip gcc-017665f63047ce47b087b0b283548a60e5abf3d2.tar.gz gcc-017665f63047ce47b087b0b283548a60e5abf3d2.tar.bz2 |
Fortran: Fix CLASS conversion check [PR102745]
PR fortran/102745
gcc/fortran/ChangeLog
* intrinsic.c (gfc_convert_type_warn): Fix checks by checking CLASS
and do typcheck in correct order for type extension.
* misc.c (gfc_typename): Print proper not internal CLASS type name.
gcc/testsuite/ChangeLog
* gfortran.dg/class_72.f90: New.
Diffstat (limited to 'gcc/fortran/intrinsic.c')
-rw-r--r-- | gcc/fortran/intrinsic.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 219f04f..f5c88d9 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -5237,12 +5237,13 @@ gfc_convert_type_warn (gfc_expr *expr, gfc_typespec *ts, int eflag, int wflag, /* In building an array constructor, gfortran can end up here when no conversion is required for an intrinsic type. We need to let derived types drop through. */ - if (from_ts.type != BT_DERIVED + if (from_ts.type != BT_DERIVED && from_ts.type != BT_CLASS && (from_ts.type == ts->type && from_ts.kind == ts->kind)) return true; - if (expr->ts.type == BT_DERIVED && ts->type == BT_DERIVED - && gfc_compare_types (&expr->ts, ts)) + if ((expr->ts.type == BT_DERIVED || expr->ts.type == BT_CLASS) + && (ts->type == BT_DERIVED || ts->type == BT_CLASS) + && gfc_compare_types (ts, &expr->ts)) return true; /* If array is true then conversion is in an array constructor where |