[C++ PATCH] Fix up C++ loop construct debug info without -gno-statement-frontiers (PR debug/90197)

Jason Merrill jason@redhat.com
Fri May 10 20:26:00 GMT 2019


On 4/26/19 11:45 AM, Jakub Jelinek wrote:
> Hi!
> 
> On Fri, Apr 26, 2019 at 09:31:36AM -0600, Jeff Law wrote:
>>> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> 
> Thanks, committed to trunk now.
> 
>>> I'll work on a C++ FE version of this next (needed as well).
> 
> Here is the C++ FE version of this patch, bootstrapped/regtested on
> x86_64-linux and i686-linux and tested with the same testcases.
> 
> For some strange reason the C++ FE does that
> protected_set_expr_location (incr, start_locus);
> on the incr expression, so the patch also uses that locus for the
> corresponding DEBUG_BEGIN_STMT instead of trying to figure out
> original locus for the incr.

That is strange.  That seems to go back to

> 2012-04-17  Tom de Vries  <tom@codesourcery.com>
> 
> 	* cp-gimplify.c (begin_bc_block): Add location parameter and use as
> 	location argument to create_artificial_label.
> 	(finish_bc_block): Change return type to void.  Remove body_seq
> 	parameter, and add block parameter.  Append label to STMT_LIST and
> 	return in block.
> 	(gimplify_cp_loop, gimplify_for_stmt, gimplify_while_stmt)
> 	(gimplify_do_stmt, gimplify_switch_stmt): Remove function.
> 	(genericize_cp_loop, genericize_for_stmt, genericize_while_stmt)
> 	(genericize_do_stmt, genericize_switch_stmt, genericize_continue_stmt)
> 	(genericize_break_stmt, genericize_omp_for_stmt): New function.
> 	(cp_gimplify_omp_for): Remove bc_continue processing.
> 	(cp_gimplify_expr): Genericize VEC_INIT_EXPR.
> 	(cp_gimplify_expr): Mark FOR_STMT, WHILE_STMT, DO_STMT, SWITCH_STMT,
> 	CONTINUE_STMT, and BREAK_STMT as unreachable.
> 	(cp_genericize_r): Genericize FOR_STMT, WHILE_STMT, DO_STMT,
> 	SWITCH_STMT, CONTINUE_STMT, BREAK_STMT and OMP_FOR.
> 	(cp_genericize_tree): New function, factored out of ...
> 	(cp_genericize): ... this function.

Surely we should only set the incr location if it doesn't already have 
one, as would have been the case before that patch.

Jason



More information about the Gcc-patches mailing list