> The problem is that in delete_insn, while deleting an undeletable label (in
> other words, transforming a label into a INSN_NOTE_DELETED_LABEL):
> - we try to find the bb of a NOTE_INSN_BASIC_BLOCK following the label using
> BLOCK_FOR_INSN (which is NULL) instead of NOTE_BASIC_BLOCK (which is not
> NULL), and
> - we don't handle the case that we find a NULL pointer for that bb
> gracefully.

Can the NOTE_BASIC_BLOCK of a NOTE_INSN_BASIC_BLOCK really be NULL?

> This comment in insn-notes.def tells us that the bb info could be in either
> of the two:
> ...
> /* Record the struct for the following basic block.  Uses
>    NOTE_BASIC_BLOCK.  FIXME: Redundant with the basic block pointer
>    now included in every insn.  */
> INSN_NOTE (BASIC_BLOCK)
> ...
> 
> The patch fixes the problems by:
> - using NOTE_BASIC_BLOCK to find the bb of NOTE_INSN_BASIC_BLOCK, and
> - explicitly handling the cases that the bb of either the label or the note
> is NULL.

I don't think that we need to handle the very last case.

> 2013-02-04  Tom de Vries  <t...@codesourcery.com>
> 
>       PR rtl-optimization/56131
>       * cfgrtl.c (delete_insn): Use NOTE_BASIC_BLOCK instead of BLOCK_FOR_INSN
>       to get the bb of a NOTE_INSN_BASIC_BLOCK.  Handle the case that the bb
>       of the label is NULL.  Add comment.

OK on principle, but remove the handling of the NULL NOTE_BASIC_BLOCK and keep 
everything in a single condition.

-- 
Eric Botcazou

Reply via email to