https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87336
Paul Thomas <pault at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2018-09-18 CC| |pault at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |pault at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #2 from Paul Thomas <pault at gcc dot gnu.org> --- Mea culpa, mea maxima culpa - I had better take it therefore. A quick fix of this bug that causes a few regressions: *************** gfc_conv_procedure_call (gfc_se * se, gf *** 5573,5578 **** --- 5574,5590 ---- tmp, build_empty_stmt (input_location)); gfc_add_expr_to_block (&se->pre, tmp); } + + if (fsym && fsym->attr.pointer + && fsym->ts.type != BT_CLASS) + { + tree desc = build_fold_indirect_ref_loc (input_location, + parmse.expr); + tmp = gfc_get_element_type (TREE_TYPE (desc)); + tmp = fold_convert (gfc_array_index_type, + size_in_bytes (tmp)); + gfc_conv_descriptor_span_set (&parmse.pre, desc, tmp); + } } } The real problem lies in gfc_conv_expr_descriptor. One of the paths through it is clearly not setting the 'span' field that is needed for pointer array indexing. I'm onto it Paul