gfc_convert_type (expr, &lvalue->ts, 0);
}
+ if (IS_POINTER (symbol)
+ && !gfc_check_pointer_assign (lvalue, rvalue, false, true))
+ return false;
+
if (last_con == NULL)
symbol->value = expr;
else
&& CLASS_DATA (sym) \
&& CLASS_DATA (sym)->attr.dimension \
&& !CLASS_DATA (sym)->attr.class_pointer)
+#define IS_POINTER(sym) \
+ (sym->ts.type == BT_CLASS && sym->attr.class_ok && CLASS_DATA (sym) \
+ ? CLASS_DATA (sym)->attr.class_pointer : sym->attr.pointer)
/* frontend-passes.cc */
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O -g" }
+! PR fortran/77693 - ICE in rtl_for_decl_init
+! Contributed by G.Steinmetz
+
+program p
+ implicit none
+ complex, target :: y = (1.,2.)
+ complex, target :: z(2) = (3.,4.)
+ complex, pointer :: a => y
+ complex, pointer :: b => z(1)
+ complex, pointer :: c, d, e
+ data c /NULL()/ ! Valid
+ data d /y/ ! Valid
+ data e /(1.,2.)/ ! { dg-error "Pointer assignment target" }
+ if (associated (a)) print *, a% re
+ if (associated (b)) print *, b% im
+ if (associated (c)) print *, c% re
+ if (associated (d)) print *, d% im
+ if (associated (e)) print *, e% re
+end