http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59917

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 31947
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31947&action=edit
gcc49-pr59917.patch

Untested partial fix, which fixes the first testcase, but still ICEs with the
second testcase.
The problem is that omp expansion relies on dominance to find the regions, but
because of the incorrect EDGE_ABNORMAL edges inserted just in case by
tree-cfg.c (note, all OpenMP regions are SESE by definition, and this single
entry single exit property must not be violated through setjmp/longjmp,
computed goto or similar in valid programs, so setjmp/longjmp is fine, as long
as it doesn't leave an OpenMP region or enter OpenMP region) the dominance
relationship is broken.

I'd say much better would be not to create the incorrect edges at all.
Say instead of making make_abnormal_goto_edges right away when walking the bbs
we could just push the bbs for which we call make_abnormal_goto_edges right now
into some vector, and, if cur_region in make_edges is ever non-NULL, create a
vector indexed by bb numbers with corresponding cur_region values at the start
of a bb, and then if the vector of bbs that might need EDGE_ABNORMAL edges is
non-empty, just do make_abnormal_goto_edges once (and process all the bbs
there, might be cheaper than for every bb needing EDGE_ABNORMAL walking all bbs
after all) and only make edges if the source and destination bbs for the
EDGE_ABNORMAL have the same omp region.

Reply via email to