public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/106866] New: [13 Regression] ICE in predicate::init_from_control_deps
@ 2022-09-07  4:08 asolokha at gmx dot com
  2022-09-07  8:59 ` [Bug tree-optimization/106866] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: asolokha at gmx dot com @ 2022-09-07  4:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106866

            Bug ID: 106866
           Summary: [13 Regression] ICE in
                    predicate::init_from_control_deps
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

gcc 13.0.0 20220904 snapshot (g:20d30e737ad79dc36817e59f1676aa8bc0c6b325) ICEs
when compiling the following testcase w/ -O1 -fno-ipa-pure-const
-Wuninitialized:

int n;

void
empty (int)
{
}

int
bar (int x)
{
  return n + x + 1;
}

__attribute__ ((pure, returns_twice)) int
foo (void)
{
  int uninitialized;

  if (n)
    {
      if (bar (0))
        return 0;

      __builtin_unreachable ();
    }

  while (uninitialized < 1)
    {
      foo ();
      empty (bar (0) == foo ());
      ++uninitialized;
    }

  return 0;
}

% gcc-13.0.0 -O1 -fno-ipa-pure-const -Wuninitialized -c ur6q8z0f.c
during GIMPLE pass: uninit
ur6q8z0f.c: In function 'foo':
ur6q8z0f.c:15:1: internal compiler error: Segmentation fault
   15 | foo (void)
      | ^~~
0xee887f crash_signal
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220904/work/gcc-13-20220904/gcc/toplev.cc:314
0x1d1e068 gimple_code
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220904/work/gcc-13-20220904/gcc/gimple.h:1806
0x1d1e068 predicate::init_from_control_deps(vec<edge_def*, va_heap, vl_ptr>
const*, unsigned int, bool)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220904/work/gcc-13-20220904/gcc/gimple-predicate-analysis.cc:1734
0x1d1eec8 predicate::init_from_control_deps(vec<edge_def*, va_heap, vl_ptr>
const*, unsigned int, bool)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220904/work/gcc-13-20220904/gcc/gimple-predicate-analysis.cc:1680
0x1d1eec8 uninit_analysis::init_use_preds(predicate&, basic_block_def*,
basic_block_def*)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220904/work/gcc-13-20220904/gcc/gimple-predicate-analysis.cc:1946
0x1d22250 uninit_analysis::is_use_guarded(gimple*, basic_block_def*, gphi*,
unsigned int, hash_set<gphi*, false, default_hash_traits<gphi*> >*)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220904/work/gcc-13-20220904/gcc/gimple-predicate-analysis.cc:2095
0x1d22869 uninit_analysis::is_use_guarded(gimple*, basic_block_def*, gphi*,
unsigned int)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220904/work/gcc-13-20220904/gcc/gimple-predicate-analysis.cc:2136
0x113d741 find_uninit_use
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220904/work/gcc-13-20220904/gcc/tree-ssa-uninit.cc:1238
0x113e08e warn_uninitialized_phi
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220904/work/gcc-13-20220904/gcc/tree-ssa-uninit.cc:1308
0x113e08e execute_late_warn_uninitialized
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220904/work/gcc-13-20220904/gcc/tree-ssa-uninit.cc:1426
0x113e08e execute
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20220904/work/gcc-13-20220904/gcc/tree-ssa-uninit.cc:1442

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

* [Bug tree-optimization/106866] [13 Regression] ICE in predicate::init_from_control_deps
  2022-09-07  4:08 [Bug tree-optimization/106866] New: [13 Regression] ICE in predicate::init_from_control_deps asolokha at gmx dot com
@ 2022-09-07  8:59 ` rguenth at gcc dot gnu.org
  2022-09-07  9:14 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-09-07  8:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106866

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1
   Target Milestone|---                         |13.0
   Last reconfirmed|                            |2022-09-07
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed, mine.

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

* [Bug tree-optimization/106866] [13 Regression] ICE in predicate::init_from_control_deps
  2022-09-07  4:08 [Bug tree-optimization/106866] New: [13 Regression] ICE in predicate::init_from_control_deps asolokha at gmx dot com
  2022-09-07  8:59 ` [Bug tree-optimization/106866] " rguenth at gcc dot gnu.org
@ 2022-09-07  9:14 ` rguenth at gcc dot gnu.org
  2022-09-07 10:00 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-09-07  9:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106866

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Hm, we fail to purge abnormal edges somewhere.  But I guess I can make uninit
analysis more forgiving as well.

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

* [Bug tree-optimization/106866] [13 Regression] ICE in predicate::init_from_control_deps
  2022-09-07  4:08 [Bug tree-optimization/106866] New: [13 Regression] ICE in predicate::init_from_control_deps asolokha at gmx dot com
  2022-09-07  8:59 ` [Bug tree-optimization/106866] " rguenth at gcc dot gnu.org
  2022-09-07  9:14 ` rguenth at gcc dot gnu.org
@ 2022-09-07 10:00 ` rguenth at gcc dot gnu.org
  2022-09-07 12:17 ` cvs-commit at gcc dot gnu.org
  2022-09-07 12:18 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-09-07 10:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106866

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
So somehow we late figure bar() doesn't return abnormally and thus DSE
eliminates a call to it but doesn't trigger

  if (need_ab_cleanup && stmt_can_make_abnormal_goto (stmt))
    bitmap_set_bit (need_ab_cleanup, bb->index);

which means when we either set ECF_LEAF to the function or cleared
cfun->calls_setjmp (the recursive invocation) we should have pruned
abnormal edges but we failed to.  That ends us with a block like

;;   basic block 4, loop depth 0
;;    pred:       12
;;                5
  # uninitialized_2(ab) = PHI <uninitialized_5(12), uninitialized_3(ab)(5)>
  goto <bb 11>; [99.96%]
;;    succ:       11
;;                5

where the 4->5 edge is abnormal but there's no stmt in this block that
could be responsible for it.  We also fail to verify ICE here.

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

* [Bug tree-optimization/106866] [13 Regression] ICE in predicate::init_from_control_deps
  2022-09-07  4:08 [Bug tree-optimization/106866] New: [13 Regression] ICE in predicate::init_from_control_deps asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2022-09-07 10:00 ` rguenth at gcc dot gnu.org
@ 2022-09-07 12:17 ` cvs-commit at gcc dot gnu.org
  2022-09-07 12:18 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-09-07 12:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106866

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:a262f969d6fd936f4fb5d9e1d5756b0dcbc925b2

commit r13-2518-ga262f969d6fd936f4fb5d9e1d5756b0dcbc925b2
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Sep 7 12:50:40 2022 +0200

    tree-optimization/106866 - avoid dead abnormal edges from DCE

    When DCE clears cfun->calls_setjmp then suddenly we don't need
    any abnormal call edges anymore.  The following makes sure to
    prune them which otherwise can confuse other passes.

            PR tree-optimization/106866
            * tree-ssa-dce.cc (eliminate_unnecessary_stmts): When
            we changed cfun->calls_setjmp make sure to purge all
            abnormal call edges.

            * gcc.dg/uninit-pr106866.c: New testcase.

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

* [Bug tree-optimization/106866] [13 Regression] ICE in predicate::init_from_control_deps
  2022-09-07  4:08 [Bug tree-optimization/106866] New: [13 Regression] ICE in predicate::init_from_control_deps asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2022-09-07 12:17 ` cvs-commit at gcc dot gnu.org
@ 2022-09-07 12:18 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-09-07 12:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106866

Richard Biener <rguenth at gcc dot gnu.org> changed:

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2022-09-07 12:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-07  4:08 [Bug tree-optimization/106866] New: [13 Regression] ICE in predicate::init_from_control_deps asolokha at gmx dot com
2022-09-07  8:59 ` [Bug tree-optimization/106866] " rguenth at gcc dot gnu.org
2022-09-07  9:14 ` rguenth at gcc dot gnu.org
2022-09-07 10:00 ` rguenth at gcc dot gnu.org
2022-09-07 12:17 ` cvs-commit at gcc dot gnu.org
2022-09-07 12:18 ` rguenth 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).