https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87597
--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> --- Internally, the problem is in frontend-passes.c's scalarized_expr(matrix_b) matrix_b starts as EXPR_VARIABLE with AR_FULL array reference for which a call to lbound(matrix_b, dim=1) is generated. That's put into gfc_simplify_expr, which calls gfc_simplify_expr on each argument and then gfc_intrinsic_func_interface. By the time the expression reaches gfc_simplify_lbound, the EXPR_VARIABLE has been replaced by an EXPR_ARRAY - and an array constructor has by definition an lower bound of one. But in scalarized_expr, we operate on the variable (with lbound = 0) and not on the array constructor (with lbound = 1)...