https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120140
Paul Thomas <pault at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pault at gcc dot gnu.org
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2025-09-22
--- Comment #3 from Paul Thomas <pault at gcc dot gnu.org> ---
I came across this, looking for similar PRs to 87908.
I think that this is correct:
diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc
index daff3b3e33b..dc13d8daf94 100644
--- a/gcc/fortran/resolve.cc
+++ b/gcc/fortran/resolve.cc
@@ -12860,7 +12860,7 @@ resolve_ordinary_assign (gfc_code *code, gfc_namespace
*ns)
return false;
}
}
- else if (lhs->ts.type == BT_CLASS)
+ else if (lhs->ts.type == BT_CLASS && !attr.dummy)
{
gfc_error ("Nonallocatable variable must not be polymorphic in intrinsic
"
"assignment at %L - check that there is a matching specific "
but gives the wrong result because q(1:2)%i should have been set to [44,43],
which is what ifx finds.
Interestingly, without the patch, the error is not output for:
s/ x([2,1]) = y([1,2]) / x(2:1:-1) = y(1:2) / in 'test'
and, yet another variant:
../pr87908/pr120140.f90:23:26:
23 | x(1:2) = y([2,1])
| 1
internal compiler error: in gfc_trans_create_temp_array, at
fortran/trans-array.cc:1501
This one is uncovering a number of nasties in gfortran :-(
Paul