public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/107876] New: [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16)
@ 2022-11-26  8:18 asolokha at gmx dot com
  2022-11-26 17:46 ` [Bug tree-optimization/107876] " pinskia at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: asolokha at gmx dot com @ 2022-11-26  8:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107876
           Summary: [13 Regression] ICE in verify_dominators, at
                    dominance.cc:1184 (error: dominator of 4 should be 14,
                    not 16)
           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: ---

gfortran 13.0.0 20221120 snapshot (g:a16a5460447eaaff0b4468064e4d7b1cc8fc42eb)
ICEs when compiling the following testcase, extracted from
clang/testsuite/CodeGenCXX/nrvo.cpp from the clang 15 test suite, w/ -O2
-funswitch-loops --param max-unswitch-insns=2:

class X {
public:
  X();
  X(const X&);
  X(const volatile X &);
  ~X();
};

X test17(int i) {
  if (false) {
  impossible:
    if (i == 3)
      return X();
  }

  while (true) {
    X x;
    if (i == 0)
      return x;
    if (i == 1)
      break;
    if (i == 2)
      continue;
    if (i == 3)
      goto impossible;
    if (i == 4)
      __builtin_exit(1);
    if (i == 5)
      return x;
  }
  return X();
}

% g++-13 -O2 -funswitch-loops --param max-unswitch-insns=2 -c iakwvinl.cpp
iakwvinl.cpp: In function 'X test17(int)':
iakwvinl.cpp:9:3: error: dominator of 4 should be 14, not 16
    9 | X test17(int i) {
      |   ^~~~~~
iakwvinl.cpp:9:3: error: dominator of 6 should be 14, not 16
iakwvinl.cpp:9:3: error: dominator of 7 should be 14, not 16
iakwvinl.cpp:9:3: error: dominator of 8 should be 14, not 16
iakwvinl.cpp:9:3: error: dominator of 10 should be 14, not 16
iakwvinl.cpp:9:3: error: dominator of 11 should be 14, not 16
iakwvinl.cpp:9:3: error: dominator of 13 should be 14, not 16
during GIMPLE pass: unswitch
iakwvinl.cpp:9:3: internal compiler error: in verify_dominators, at
dominance.cc:1184
0x7a0ae6 verify_dominators(cdi_direction)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221120/work/gcc-13-20221120/gcc/dominance.cc:1184
0x121a869 checking_verify_dominators
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221120/work/gcc-13-20221120/gcc/dominance.h:76
0x121a869 cleanup_tree_cfg_noloop
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221120/work/gcc-13-20221120/gcc/tree-cfgcleanup.cc:1113
0x121a869 cleanup_tree_cfg(unsigned int)
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221120/work/gcc-13-20221120/gcc/tree-cfgcleanup.cc:1212
0x10dddac execute_function_todo
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221120/work/gcc-13-20221120/gcc/passes.cc:2057
0x10de20e execute_todo
       
/var/tmp/portage/sys-devel/gcc-13.0.0_p20221120/work/gcc-13-20221120/gcc/passes.cc:2145

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

* [Bug tree-optimization/107876] [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16)
  2022-11-26  8:18 [Bug tree-optimization/107876] New: [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) asolokha at gmx dot com
@ 2022-11-26 17:46 ` pinskia at gcc dot gnu.org
  2022-11-26 17:48 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-26 17:46 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0

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

* [Bug tree-optimization/107876] [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16)
  2022-11-26  8:18 [Bug tree-optimization/107876] New: [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) asolokha at gmx dot com
  2022-11-26 17:46 ` [Bug tree-optimization/107876] " pinskia at gcc dot gnu.org
@ 2022-11-26 17:48 ` pinskia at gcc dot gnu.org
  2022-11-28  6:48 ` [Bug tree-optimization/107876] [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) since r13-3749-g7314b98b1bcd382c marxin at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-26 17:48 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-11-26
           Keywords|                            |ice-checking
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. Maybe introduced by r13-3875-g9e11ceef165bc0 (but didn't check).

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

* [Bug tree-optimization/107876] [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) since r13-3749-g7314b98b1bcd382c
  2022-11-26  8:18 [Bug tree-optimization/107876] New: [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) asolokha at gmx dot com
  2022-11-26 17:46 ` [Bug tree-optimization/107876] " pinskia at gcc dot gnu.org
  2022-11-26 17:48 ` pinskia at gcc dot gnu.org
@ 2022-11-28  6:48 ` marxin at gcc dot gnu.org
  2022-11-28  7:36 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-11-28  6:48 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[13 Regression] ICE in      |[13 Regression] ICE in
                   |verify_dominators, at       |verify_dominators, at
                   |dominance.cc:1184 (error:   |dominance.cc:1184 (error:
                   |dominator of 4 should be    |dominator of 4 should be
                   |14, not 16)                 |14, not 16) since
                   |                            |r13-3749-g7314b98b1bcd382c
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |rguenth at gcc dot gnu.org

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r13-3749-g7314b98b1bcd382c.

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

* [Bug tree-optimization/107876] [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) since r13-3749-g7314b98b1bcd382c
  2022-11-26  8:18 [Bug tree-optimization/107876] New: [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2022-11-28  6:48 ` [Bug tree-optimization/107876] [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) since r13-3749-g7314b98b1bcd382c marxin at gcc dot gnu.org
@ 2022-11-28  7:36 ` rguenth at gcc dot gnu.org
  2022-11-28  8:13 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-11-28  7:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Mine.

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

* [Bug tree-optimization/107876] [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) since r13-3749-g7314b98b1bcd382c
  2022-11-26  8:18 [Bug tree-optimization/107876] New: [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) asolokha at gmx dot com
                   ` (3 preceding siblings ...)
  2022-11-28  7:36 ` rguenth at gcc dot gnu.org
@ 2022-11-28  8:13 ` rguenth at gcc dot gnu.org
  2022-11-28  9:05 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-11-28  8:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's a latent issue before this rev. since clean_up_after_unswitching ends up
removing all exit edges from one copy, keeping an infinite loop.  The function
uses remove_edge () for this, not remove_edge_and_dominated_blocks.

Testing a patch.

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

* [Bug tree-optimization/107876] [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) since r13-3749-g7314b98b1bcd382c
  2022-11-26  8:18 [Bug tree-optimization/107876] New: [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) asolokha at gmx dot com
                   ` (4 preceding siblings ...)
  2022-11-28  8:13 ` rguenth at gcc dot gnu.org
@ 2022-11-28  9:05 ` cvs-commit at gcc dot gnu.org
  2022-11-28  9:05 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-28  9:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 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:238cf114de16518c6569f0cdd2c4d6211ac98a74

commit r13-4317-g238cf114de16518c6569f0cdd2c4d6211ac98a74
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Nov 28 09:19:33 2022 +0100

    tree-optimization/107876 - unswitching of switch

    The following shows a missed update of dominators when unswitching
    removes unreachable edges from switch stmts it unswitches.  Fixed
    by wiping dominator info in that case.

            PR tree-optimization/107876
            * tree-ssa-loop-unswitch.cc (clean_up_after_unswitching): Wipe
            dominator info if we removed an edge.

            * g++.dg/tree-ssa/pr107876.C: New testcase.

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

* [Bug tree-optimization/107876] [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) since r13-3749-g7314b98b1bcd382c
  2022-11-26  8:18 [Bug tree-optimization/107876] New: [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) asolokha at gmx dot com
                   ` (5 preceding siblings ...)
  2022-11-28  9:05 ` cvs-commit at gcc dot gnu.org
@ 2022-11-28  9:05 ` rguenth at gcc dot gnu.org
  2023-08-19  9:27 ` fxcoudert at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-11-28  9:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

* [Bug tree-optimization/107876] [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) since r13-3749-g7314b98b1bcd382c
  2022-11-26  8:18 [Bug tree-optimization/107876] New: [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) asolokha at gmx dot com
                   ` (6 preceding siblings ...)
  2022-11-28  9:05 ` rguenth at gcc dot gnu.org
@ 2023-08-19  9:27 ` fxcoudert at gcc dot gnu.org
  2023-09-01 21:43 ` egallager at gcc dot gnu.org
  2023-09-12  7:12 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2023-08-19  9:27 UTC (permalink / raw)
  To: gcc-bugs

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

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

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

--- Comment #7 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
The test case (g++.dg/tree-ssa/pr107876.C) fails on aarch64-darwin.

FAIL: g++.dg/tree-ssa/pr107876.C  -std=gnu++14  scan-tree-dump unswitch
"unswitching loop 1 on .switch. with condition: i_[0-9]+\\(D\\) == 2"
FAIL: g++.dg/tree-ssa/pr107876.C  -std=gnu++17  scan-tree-dump unswitch
"unswitching loop 1 on .switch. with condition: i_[0-9]+\\(D\\) == 2"
FAIL: g++.dg/tree-ssa/pr107876.C  -std=gnu++20  scan-tree-dump unswitch
"unswitching loop 1 on .switch. with condition: i_[0-9]+\\(D\\) == 2"

The output says:

;; Function test17 (_Z6test17i, funcdef_no=0, decl_uid=4194, cgraph_uid=1,
symbol_order=0)

Estimating # of iterations of loop 1
g++.dg/tree-ssa/pr107876.C:21:7: optimized: unswitching loop 1 on 'if' with
condition: i_7(D) == 0
g++.dg/tree-ssa/pr107876.C:21:7: note: optimized sizes estimated to 0 (true)
and 0 (false) from original size 16

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

* [Bug tree-optimization/107876] [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) since r13-3749-g7314b98b1bcd382c
  2022-11-26  8:18 [Bug tree-optimization/107876] New: [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) asolokha at gmx dot com
                   ` (7 preceding siblings ...)
  2023-08-19  9:27 ` fxcoudert at gcc dot gnu.org
@ 2023-09-01 21:43 ` egallager at gcc dot gnu.org
  2023-09-12  7:12 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: egallager at gcc dot gnu.org @ 2023-09-01 21:43 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |---
           Keywords|                            |testsuite-fail
                 CC|                            |egallager at gcc dot gnu.org
             Status|RESOLVED                    |REOPENED

--- Comment #8 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Francois-Xavier Coudert from comment #7)
> The test case (g++.dg/tree-ssa/pr107876.C) fails on aarch64-darwin.
> 
> FAIL: g++.dg/tree-ssa/pr107876.C  -std=gnu++14  scan-tree-dump unswitch
> "unswitching loop 1 on .switch. with condition: i_[0-9]+\\(D\\) == 2"
> FAIL: g++.dg/tree-ssa/pr107876.C  -std=gnu++17  scan-tree-dump unswitch
> "unswitching loop 1 on .switch. with condition: i_[0-9]+\\(D\\) == 2"
> FAIL: g++.dg/tree-ssa/pr107876.C  -std=gnu++20  scan-tree-dump unswitch
> "unswitching loop 1 on .switch. with condition: i_[0-9]+\\(D\\) == 2"
> 
> The output says:
> 
> ;; Function test17 (_Z6test17i, funcdef_no=0, decl_uid=4194, cgraph_uid=1,
> symbol_order=0)
> 
> Estimating # of iterations of loop 1
> g++.dg/tree-ssa/pr107876.C:21:7: optimized: unswitching loop 1 on 'if' with
> condition: i_7(D) == 0
> g++.dg/tree-ssa/pr107876.C:21:7: note: optimized sizes estimated to 0 (true)
> and 0 (false) from original size 16

reopening, then

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

* [Bug tree-optimization/107876] [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) since r13-3749-g7314b98b1bcd382c
  2022-11-26  8:18 [Bug tree-optimization/107876] New: [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) asolokha at gmx dot com
                   ` (8 preceding siblings ...)
  2023-09-01 21:43 ` egallager at gcc dot gnu.org
@ 2023-09-12  7:12 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-09-12  7:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED
           Keywords|testsuite-fail              |

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Please open new bugs for testsuite fails, the verify_dominator ICE is fixed.

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

end of thread, other threads:[~2023-09-12  7:12 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-26  8:18 [Bug tree-optimization/107876] New: [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) asolokha at gmx dot com
2022-11-26 17:46 ` [Bug tree-optimization/107876] " pinskia at gcc dot gnu.org
2022-11-26 17:48 ` pinskia at gcc dot gnu.org
2022-11-28  6:48 ` [Bug tree-optimization/107876] [13 Regression] ICE in verify_dominators, at dominance.cc:1184 (error: dominator of 4 should be 14, not 16) since r13-3749-g7314b98b1bcd382c marxin at gcc dot gnu.org
2022-11-28  7:36 ` rguenth at gcc dot gnu.org
2022-11-28  8:13 ` rguenth at gcc dot gnu.org
2022-11-28  9:05 ` cvs-commit at gcc dot gnu.org
2022-11-28  9:05 ` rguenth at gcc dot gnu.org
2023-08-19  9:27 ` fxcoudert at gcc dot gnu.org
2023-09-01 21:43 ` egallager at gcc dot gnu.org
2023-09-12  7:12 ` 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).