https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103691
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #4) > To me it looks like the PR52329 change wasn't correct. In particular, it > should have been using true as the second argument and not false and > therefore should have been removed in the r12-21-g0bf8cd9d5e8ac changes > rather than kept. > If I modify the testcase from a(0) to a(2), then I see > pr103691.f90.037t.fre1: # DEBUG D.4293 => &a[0] > and > pr103691.f90.038t.evrp: # DEBUG D.4293 => &2.0e+0 > The &2.0e+0 is just a wrong-debug, debug info was supposed to contain > address of > a, not address of some constant that happens to be in the first element of > the array. > fold_stmt_1 earlier has: > case GIMPLE_DEBUG: > if (gimple_debug_bind_p (stmt)) > { > tree *val = gimple_debug_bind_get_value_ptr (stmt); > if (*val > && (REFERENCE_CLASS_P (*val) > || TREE_CODE (*val) == ADDR_EXPR) > && maybe_canonicalize_mem_ref_addr (val, true)) > changed = true; > } > which I believe should perform whatever PR52329 was meant to deal with. > So I think > else if (val > && TREE_CODE (val) == ADDR_EXPR) > { > tree ref = TREE_OPERAND (val, 0); > tree tem = maybe_fold_reference (ref); > if (tem) > { > tem = build_fold_addr_expr_with_type (tem, TREE_TYPE > (val)); > gimple_debug_bind_set_value (stmt, tem); > changed = true; > } > } > should be just dropped. Agreed.