Fix oversight during try-finally lowering

Eric Botcazou ebotcazou@adacore.com
Sat Jun 30 09:43:00 GMT 2012


It pertains to the source location assigned to the finally switch: the comment 
in lower_try_finally_switch reads:

   /* The location of the finally is either the last stmt in the finally
      block or the location of the TRY_FINALLY itself.  */

but the code reads:

  finally_loc = gimple_seq_last_stmt (tf->top_p_seq) != NULL ?
    gimple_location (gimple_seq_last_stmt (tf->top_p_seq))
    : tf_loc;

so it uses the location of last stmt of the eval block.  Needless to say that 
this seriously screws up the coverage of the construct: the last stmt of the 
eval block is always reported as covered!

Fixed thusly, tested on x86_64-suse-linux, applied on the mainline as obvious.
This isn't a recent regression, but I took the liberty to put it on the 4.7 
branch as well.


2012-06-29  Eric Botcazou  <ebotcazou@adacore.com>

	* tree-eh.c (lower_try_finally_switch): Really put the location of the
	last statement of the finally block onto the switch.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-diff
Size: 660 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120630/cf7c86fd/attachment.bin>


More information about the Gcc-patches mailing list