https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79894
--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
OTOH this is really GIGO - the frontend feeds us with incompatible types
(there's only one complex type per scalar type).
So I am testing
Index: gcc/fortran/trans.c
===================================================================
--- gcc/fortran/trans.c (revision 245913)
+++ gcc/fortran/trans.c (working copy)
@@ -151,11 +151,11 @@ gfc_add_modify_loc (location_t loc, stmt
tree t1, t2;
t1 = TREE_TYPE (rhs);
t2 = TREE_TYPE (lhs);
- /* Make sure that the types of the rhs and the lhs are the same
+ /* Make sure that the types of the rhs and the lhs are compatible
for scalar assignments. We should probably have something
similar for aggregates, but right now removing that check just
breaks everything. */
- gcc_checking_assert (t1 == t2
+ gcc_checking_assert (TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2)
|| AGGREGATE_TYPE_P (TREE_TYPE (lhs)));
tmp = fold_build2_loc (loc, MODIFY_EXPR, void_type_node, lhs,
instead.