This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, tree-optimization]: Fix PR tree-optimization/32821, segfault with -ftree-dump-tree-ifcvt-details
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Uros Bizjak" <ubizjak at gmail dot com>
- Cc: "GCC Patches" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 7 Sep 2007 11:38:46 +0200
- Subject: Re: [PATCH, tree-optimization]: Fix PR tree-optimization/32821, segfault with -ftree-dump-tree-ifcvt-details
- References: <46E02A38.5030302@gmail.com>
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.