This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/56094] Invalid line number info generated with tree-level ivopts


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56094

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-24 15:06:28 UTC ---
So, the reason seems to be:
      mod = build2 (INIT_EXPR, TREE_TYPE (t), t, unshare_expr (val));

      SET_EXPR_LOCATION (mod, EXPR_LOC_OR_HERE (val));
in:
#0  internal_get_tmp_var (val=0x7ffff1aeaaa0, pre_p=0x7fffffffdda8, post_p=0x0,
is_formal=true) at ../../gcc/gimplify.c:636
#1  0x0000000000832a3e in get_formal_tmp_var (val=0x7ffff1aeaaa0,
pre_p=0x7fffffffdda8) at ../../gcc/gimplify.c:657
#2  0x000000000084d3b7 in gimplify_expr (expr_p=0x7fffffffdcf8,
pre_p=0x7fffffffdda8, post_p=0x7fffffffdbb0, 
    gimple_test_f=0x80befc <is_gimple_val(tree_node*)>, fallback=1) at
../../gcc/gimplify.c:8023
#3  0x000000000084f7c8 in force_gimple_operand_1 (expr=0x7ffff1aeaaa0,
stmts=0x7fffffffdda8, gimple_test_f=0x80befc <is_gimple_val(tree_node*)>, 
    var=0x0) at ../../gcc/gimplify.c:8633
#4  0x000000000084f878 in force_gimple_operand_gsi_1 (gsi=0x7fffffffde60,
expr=0x7ffff1aeaaa0, 
    gimple_test_f=0x80befc <is_gimple_val(tree_node*)>, var=0x0, before=true,
m=GSI_SAME_STMT) at ../../gcc/gimplify.c:8669
#5  0x000000000084f923 in force_gimple_operand_gsi (gsi=0x7fffffffde60,
expr=0x7ffff1aeaaa0, simple_p=true, var=0x0, before=true, m=GSI_SAME_STMT)
    at ../../gcc/gimplify.c:8698
#6  0x0000000000b79414 in rewrite_use_nonlinear_expr (data=0x7fffffffdf70,
use=0x1887f90, cand=0x1887f40) at ../../gcc/tree-ssa-loop-ivopts.c:6151
#7  0x0000000000b79df5 in rewrite_use (data=0x7fffffffdf70, use=0x1887f90,
cand=0x1887f40) at ../../gcc/tree-ssa-loop-ivopts.c:6358
#8  0x0000000000b79eb7 in rewrite_uses (data=0x7fffffffdf70) at
../../gcc/tree-ssa-loop-ivopts.c:6391
#9  0x0000000000b7b0a0 in tree_ssa_iv_optimize_loop (data=0x7fffffffdf70,
loop=0x7ffff198bb28) at ../../gcc/tree-ssa-loop-ivopts.c:6716

During original gimplification, I can understand the OR_HERE (aka
input_location) part there, or in passes that maintain input_location.
But generally force_gimple_operand* is often called even from passes that don't
maintain reasonable input_location.  So, either the above should be hack like
      if (gimplify_ctxp->into_ssa)
        SET_EXPR_LOCATION (mod, EXPR_LOCATION (val));
      else
        SET_EXPR_LOCATION (mod, EXPR_LOC_OR_HERE (val));
(or gimplify_ctxp->use_input_location or whatever), or perhaps
force_gimple_operand* should temporarily set input_location to UNKNOWN_LOCATION
and restore it back from a saved copy before returning.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]