[PATCH] Fix -fcompare-debug due to DEBUG_BEGIN_STMTs (PR debug/83419)

Jakub Jelinek jakub@redhat.com
Mon Dec 18 13:35:00 GMT 2017


On Mon, Dec 18, 2017 at 02:17:18PM +0100, Jakub Jelinek wrote:
> One option would be to deal with that in pop_stmt_list and the C++ caller
> thereof, where we right now have:
> 
>       /* If the statement list contained exactly one statement, then
>          extract it immediately.  */
>       if (tsi_one_before_end_p (i))
>         {
>           u = tsi_stmt (i);
>           tsi_delink (&i);
>           free_stmt_list (t);
>           t = u;
>         }
> 
> This part would need a MAY_HAVE_DEBUG_MARKER_STMTS variant that would
> check for the case where there are just DEBUG_BEGIN_STMT markers + one other
> stmt (+ maybe some further DEBUG_BEGIN_STMT markers) and nothing else.
> If that one other stmt doesn't have TREE_SIDE_EFFECTS, clear
> TREE_SIDE_EFFECTS on the whole statement list to get the same
> TREE_SIDE_EFFECTS from the returned expression as without -g.

Like this (the cp_parser_omp_for_loop_init function would need similar
changes).  Except while it works for this new testcase and some of the
testcases I've listed, it still doesn't work for others.

Alex, I'm giving up here.

	Jakub



More information about the Gcc-patches mailing list