This is the mail archive of the gcc-patches@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]

Re: [patch] Small improvements to coverage info (1/n)


On Wed, Jul 03, 2019 at 12:46:37PM +0200, Eric Botcazou wrote:
> 2019-07-03  Eric Botcazou  <ebotcazou@adacore.com>
> 
> 	* tree-cfg.c (gimple_make_forwarder_block): Propagate location info on
> 	phi nodes if possible.
> 	* tree-scalar-evolution.c (final_value_replacement_loop): Propagate
> 	location info on the newly created statement.
> 	* tree-ssa-loop-manip.c (create_iv): Propagate location info on the
> 	newly created increment if needed.

> --- tree-ssa-loop-manip.c	(revision 272930)
> +++ tree-ssa-loop-manip.c	(working copy)
> @@ -126,10 +126,22 @@ create_iv (tree base, tree step, tree va
>      gsi_insert_seq_on_edge_immediate (pe, stmts);
>  
>    stmt = gimple_build_assign (va, incr_op, vb, step);
> +  /* Prevent the increment from inheriting a bogus location if it is not put
> +     immediately after a statement whose location is known.  */
>    if (after)
> -    gsi_insert_after (incr_pos, stmt, GSI_NEW_STMT);
> +    {
> +      if (gsi_end_p (*incr_pos))
> +	{
> +	  edge e = single_succ_edge (gsi_bb (*incr_pos));
> +	  gimple_set_location (stmt, e->goto_locus);
> +	}
> +      gsi_insert_after (incr_pos, stmt, GSI_NEW_STMT);
> +    }
>    else
> -    gsi_insert_before (incr_pos, stmt, GSI_NEW_STMT);
> +    {
> +      gimple_set_location (stmt, gimple_location (gsi_stmt (*incr_pos)));
> +      gsi_insert_before (incr_pos, stmt, GSI_NEW_STMT);
> +    }

This change broke gomp/pr88107.c test:
FAIL: gcc.dg/gomp/pr88107.c (internal compiler error)
FAIL: gcc.dg/gomp/pr88107.c (test for excess errors)
Excess errors:
during GIMPLE pass: graphite
/usr/src/gcc/gcc/testsuite/gcc.dg/gomp/pr88107.c:26:1: internal compiler error: Segmentation fault
0x11942a4 crash_signal
        ../../gcc/toplev.c:326
0x13b5861 gimple_location
        ../../gcc/gimple.h:1805
0x13b76f8 create_iv(tree_node*, tree_node*, tree_node*, loop*, gimple_stmt_iterator*, bool, tree_node**, tree_node**)
        ../../gcc/tree-ssa-loop-manip.c:142
0xaa2c95 create_empty_loop_on_edge(edge_def*, tree_node*, tree_node*, tree_node*, tree_node*, tree_node**, tree_node**, loop*)
        ../../gcc/cfgloopmanip.c:831

Apparently gsi_end_p (*incr_pos) is true and after is false, so
gsi_stmt (*incr_pos) is NULL.  One needs graphite enabled.

	Jakub


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