https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83990
--- Comment #7 from Martin Jambor <jamborm at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #4) > > ... > > The statement on which on the original testcase it warns indeed has no > location, that was created during IPA optimizations: > ipa_modify_call_arguments does: > loc = DECL_P (base) ? DECL_SOURCE_LOCATION (base) > : EXPR_LOCATION (base); > This itself is weird in this case, base is a SSA_NAME this_4(D), so has no > location and loc is UNKNOWN_LOCATION. Interesting, I see base being an ADDR_EXPR on trunk. But anyway... > Then we: > /* If expr is not a valid gimple call argument emit > a load into a temporary. */ > if (is_gimple_reg_type (TREE_TYPE (expr))) > { > gimple *tem = gimple_build_assign (NULL_TREE, expr); > if (gimple_in_ssa_p (cfun)) > { > gimple_set_vuse (tem, gimple_vuse (stmt)); > expr = make_ssa_name (TREE_TYPE (expr), tem); > } > else > expr = create_tmp_reg (TREE_TYPE (expr)); > gimple_assign_set_lhs (tem, expr); > gsi_insert_before (&gsi, tem, GSI_SAME_STMT); > and don't gimple_set_location for it at all. Wonder if loc shouldn't be set > to e.g. gimple_location (stmt) That might indeed make more sense, I will look into it. But please note that I get exactly the same warning when I add -fno-ipa-sra on the command line (and I have verified in gdb that ipa_modify_call_arguments is not invoked at all with the option just to double check) so ipa_modify_call_arguments cannot be the whole story.