https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96896

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The error occurs for the LHS of:
    myshape(b) = 0.0

reshape_test:_F.DA0  =>  myshape[[((reshape_test:b(FULL)))]]

(gfc_debug_expr output)

(gdb) p lvalue->rank 
$9 = 0
(gdb) p rvalue->rank 
$10 = 2

Maybe something like

--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -11598 +11598 @@ resolve_ptr_fcn_assign (gfc_code **code, gfc_namespace *ns)
-  tmp_ptr_expr = get_temp_from_expr ((*code)->expr2, ns);
+  tmp_ptr_expr = get_temp_from_expr ((*code)->expr1, ns);

Or if expr2->rank == 0 and expr1->rank > 0, it has to be updated afterwards. At
the moment, I do not see whether 'expr1' or 'expr2' makes more sense in terms
of polymorphic variables etc.

However, at a glance, expr1 seems to be more sensible...

Reply via email to