public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/59917] New: [4.9 Regression] ICE in calc_dfs_tree, at dominance.c:401
@ 2014-01-23 14:04 doko at gcc dot gnu.org
  2014-01-23 17:01 ` [Bug middle-end/59917] " jakub at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: doko at gcc dot gnu.org @ 2014-01-23 14:04 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59917
           Summary: [4.9 Regression] ICE in calc_dfs_tree, at
                    dominance.c:401
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: doko at gcc dot gnu.org

Created attachment 31930
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31930&action=edit
preprocessed source

seen with trunk 20140122, works with the 4.8 branch

$ g++ -fopenmp -c datatypes.ii
datatypes.cpp: In function '<built-in>':
datatypes.cpp:5690:37: internal compiler error: in calc_dfs_tree, at
dominance.c:401
Please submit a full bug report,
with preprocessed source if appropriate.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug middle-end/59917] [4.9 Regression] ICE in calc_dfs_tree, at dominance.c:401
  2014-01-23 14:04 [Bug middle-end/59917] New: [4.9 Regression] ICE in calc_dfs_tree, at dominance.c:401 doko at gcc dot gnu.org
@ 2014-01-23 17:01 ` jakub at gcc dot gnu.org
  2014-01-24 13:31 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-23 17:01 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-01-23
                 CC|                            |jakub at gcc dot gnu.org
   Target Milestone|---                         |4.9.0
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Reduced testcase for -fopenmp:
struct J;
extern "C" int setjmp (struct J[1]) throw ();
extern struct J j[1];
void foo (unsigned long);

void
bar (void)
{
  if (setjmp (j) == 0)
    {
#pragma omp parallel
      for (long int k = 0; k < 10; ++k)
        foo (k);
    }
}

Started likely with r198096.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug middle-end/59917] [4.9 Regression] ICE in calc_dfs_tree, at dominance.c:401
  2014-01-23 14:04 [Bug middle-end/59917] New: [4.9 Regression] ICE in calc_dfs_tree, at dominance.c:401 doko at gcc dot gnu.org
  2014-01-23 17:01 ` [Bug middle-end/59917] " jakub at gcc dot gnu.org
@ 2014-01-24 13:31 ` jakub at gcc dot gnu.org
  2014-01-29 11:03 ` jakub at gcc dot gnu.org
  2014-01-29 11:04 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-24 13:31 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug middle-end/59917] [4.9 Regression] ICE in calc_dfs_tree, at dominance.c:401
  2014-01-23 14:04 [Bug middle-end/59917] New: [4.9 Regression] ICE in calc_dfs_tree, at dominance.c:401 doko at gcc dot gnu.org
  2014-01-23 17:01 ` [Bug middle-end/59917] " jakub at gcc dot gnu.org
  2014-01-24 13:31 ` jakub at gcc dot gnu.org
@ 2014-01-29 11:03 ` jakub at gcc dot gnu.org
  2014-01-29 11:04 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-29 11:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Wed Jan 29 11:02:46 2014
New Revision: 207231

URL: http://gcc.gnu.org/viewcvs?rev=207231&root=gcc&view=rev
Log:
    PR middle-end/59917
    PR tree-optimization/59920
    * tree.c (build_common_builtin_nodes): Remove
    __builtin_setjmp_dispatcher initialization.
    * omp-low.h (make_gimple_omp_edges): Add a new int * argument.
    * profile.c (branch_prob): Use gsi_start_nondebug_after_labels_bb
    instead of gsi_after_labels + manually skipping debug stmts.
    Don't ignore bbs with BUILT_IN_SETJMP_DISPATCHER, instead
    ignore bbs with IFN_ABNORMAL_DISPATCHER.
    * tree-inline.c (copy_edges_for_bb): Remove
    can_make_abnormal_goto argument, instead add abnormal_goto_dest
    argument.  Ignore computed_goto_p stmts.  Don't call
    make_abnormal_goto_edges.  If a call might need abnormal edges
    for non-local gotos, see if it already has an edge to
    IFN_ABNORMAL_DISPATCHER or if it is IFN_ABNORMAL_DISPATCHER
    with true argument, don't do anything then, otherwise add
    EDGE_ABNORMAL from the call's bb to abnormal_goto_dest.
    (copy_cfg_body): Compute abnormal_goto_dest, adjust copy_edges_for_bb
    caller.
    * gimple-low.c (struct lower_data): Remove calls_builtin_setjmp.
    (lower_function_body): Don't emit __builtin_setjmp_dispatcher.
    (lower_stmt): Don't set data->calls_builtin_setjmp.
    (lower_builtin_setjmp): Adjust comment.
    * builtins.def (BUILT_IN_SETJMP_DISPATCHER): Remove.
    * tree-cfg.c (found_computed_goto): Remove.
    (factor_computed_gotos): Remove.
    (make_goto_expr_edges): Return bool, true for computed gotos.
    Don't call make_abnormal_goto_edges.
    (build_gimple_cfg): Don't set found_computed_goto, don't call
    factor_computed_gotos.
    (computed_goto_p): No longer static.
    (make_blocks): Don't set found_computed_goto.
    (get_abnormal_succ_dispatcher, handle_abnormal_edges): New functions.
    (make_edges): If make_goto_expr_edges returns true, push bb
    into ab_edge_goto vector, for stmt_can_make_abnormal_goto calls
    instead of calling make_abnormal_goto_edges push bb into ab_edge_call
    vector.  Record mapping between bbs and OpenMP regions if there
    are any, adjust make_gimple_omp_edges caller.  Call
    handle_abnormal_edges.
    (make_abnormal_goto_edges): Remove.
    * tree-cfg.h (make_abnormal_goto_edges): Remove.
    (computed_goto_p, get_abnormal_succ_dispatcher): New prototypes.
    * internal-fn.c (expand_ABNORMAL_DISPATCHER): New function.
    * builtins.c (expand_builtin): Don't handle
    BUILT_IN_SETJMP_DISPATCHER.
    * internal-fn.def (ABNORMAL_DISPATCHER): New.
    * omp-low.c (make_gimple_omp_edges): Add region_idx argument, when
    filling *region also set *region_idx to (*region)->entry->index.

    * gcc.dg/pr59920-1.c: New test.
    * gcc.dg/pr59920-2.c: New test.
    * gcc.dg/pr59920-3.c: New test.
    * c-c++-common/gomp/pr59917-1.c: New test.
    * c-c++-common/gomp/pr59917-2.c: New test.

Added:
    trunk/gcc/testsuite/c-c++-common/gomp/pr59917-1.c
    trunk/gcc/testsuite/c-c++-common/gomp/pr59917-2.c
    trunk/gcc/testsuite/gcc.dg/pr59920-1.c
    trunk/gcc/testsuite/gcc.dg/pr59920-2.c
    trunk/gcc/testsuite/gcc.dg/pr59920-3.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/builtins.c
    trunk/gcc/builtins.def
    trunk/gcc/gimple-low.c
    trunk/gcc/internal-fn.c
    trunk/gcc/internal-fn.def
    trunk/gcc/omp-low.c
    trunk/gcc/omp-low.h
    trunk/gcc/profile.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-cfg.c
    trunk/gcc/tree-cfg.h
    trunk/gcc/tree-inline.c
    trunk/gcc/tree.c


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug middle-end/59917] [4.9 Regression] ICE in calc_dfs_tree, at dominance.c:401
  2014-01-23 14:04 [Bug middle-end/59917] New: [4.9 Regression] ICE in calc_dfs_tree, at dominance.c:401 doko at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-01-29 11:03 ` jakub at gcc dot gnu.org
@ 2014-01-29 11:04 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-01-29 11:04 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-01-29 11:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-23 14:04 [Bug middle-end/59917] New: [4.9 Regression] ICE in calc_dfs_tree, at dominance.c:401 doko at gcc dot gnu.org
2014-01-23 17:01 ` [Bug middle-end/59917] " jakub at gcc dot gnu.org
2014-01-24 13:31 ` jakub at gcc dot gnu.org
2014-01-29 11:03 ` jakub at gcc dot gnu.org
2014-01-29 11:04 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).