[PATCH, tree-optimization]: Fix PR tree-optimization/32821, segfault with -ftree-dump-tree-ifcvt-details

Richard Guenther richard.guenther@gmail.com
Fri Sep 7 10:31:00 GMT 2007


On 9/6/07, Uros Bizjak <ubizjak@gmail.com> wrote:
> Hello!
>
> As described in PR, compiler segfaults when trying to iterate through bb
> with no stmt. Attached patch adds checking for NULL bb_stmt_list in
> [c]bsi_start() and [c]bsi_last() to solve this problem.
>
> Patch was bootstrapped on x86_64-pc-linux-gnu. Regression test {,-m32}
> is in progress. OK if it passes?
>
> [BTW: Yes, -ftree-vectorize is enough , we don't need to add -msse2 or
> -altivec or whatever to trigger this bug.]

The problem is because tree-if-conv.c does

     /* Update stmt list.  */
      last = tsi_last (bb_stmt_list (merge_target_bb));
      tsi_link_after (&last, bb_stmt_list (bb), TSI_NEW_STMT);
      set_bb_stmt_list (bb, NULL);

but NULL statement lists are not allowed.  Instead the set_bb_stmt_list call
should read

set_bb_stmt_list (bb, alloc_stmt_list());

matching what create_bb does.

This change is pre-approved.

Richard.



More information about the Gcc-patches mailing list