[ Was: Re: [PR65637][PATCH][1/3] Fix gcc_assert in expand_omp_for_static_chunk ] On 15/04/15 15:15, Tom de Vries wrote: > On 15-04-15 15:10, Tom de Vries wrote: >> Hi, >> >> This patch series fixes PR65637. >> > This patch fixes a segfault in an gcc_assert in expand_omp_for_static_chunk > while compiling autopar/pr46099.c. > > When compiling f1 from autopar/pr46099.c using > expand_omp_for_static_chunk, we > redirect the edge (trip_update_bb -> fin_bb) to point to iter_part_bb: > ... > redirect_edge_and_branch (single_succ_edge (trip_update_bb), > iter_part_bb); > ... > > And fin_bb is an empty block without any phis, so during the redirect we > don't > store any entries in the edge_var_map: > ... > (gdb) call debug_bb (fin_bb) > ;; basic block 18, loop depth 0, count 0, freq 0, maybe hot > ;; prev block 21, next block 16, flags: (NEW) > ;; pred: 21 [100.0%] (FALLTHRU) > ;; 19 (FALSE_VALUE) > ;; succ: 16 [100.0%] (FALLTHRU) > ... > > Consequently, head will be NULL. > ... > vec *head = redirect_edge_var_map_vector (re); > ... > > And because head is NULL, this assert causes a segfault: > ... > gcc_assert (gsi_end_p (psi) && i == head->length ()); > ... > > This patch fixes that, by handling the case that head is NULL in the > assert. > This updated patch includes a test-case. OK for trunk? Thanks, - Tom