https://gcc.gnu.org/bugzilla/show_bug.cgi?id=129202
Bug ID: 129202
Summary: [17 Regression] ICE in verify_dominators, at
dominance.cc:1194 at -O3 (vect,
slpeel_tree_duplicate_loop_to_edge_cfg) for a loop
storing a _BitInt bit-field since r17-4892
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: haoxintu at gmail dot com
Target Milestone: ---
Hi,
$cat repro.c
struct s { _BitInt(255) b; _BitInt(13) c : 7; };
void f (struct s *p, _BitInt(5) x, long n)
{
for (long i = 0; i < n; i++)
p[i].c = p[x * i].b = (_BitInt(255)) x << 76;
}
$ gcc -O3 -c repro.c
repro.c: In function 'f':
repro.c:3:6: error: dominator of 14 should be 3, not 15
3 | void f (struct s *p, _BitInt(5) x, long n)
| ^
during GIMPLE pass: vect
repro.c:3:6: internal compiler error: in verify_dominators, at
dominance.cc:1194
0x8f8feb verify_dominators(cdi_direction)
../../gcc/dominance.cc:1194
0x176cba8 checking_verify_dominators(cdi_direction)
../../gcc/dominance.h:76
0x176cba8 slpeel_tree_duplicate_loop_to_edge_cfg(loop*, edge_def*, loop*,
edge_def*, edge_def*, edge_def**, bool, vec<basic_block_def*, va_heap,
vl_ptr>*, bool, bool, bool)
../../gcc/tree-vect-loop-manip.cc:2154
0x176f609 vect_do_peeling(_loop_vec_info*, tree_node*, tree_node*, tree_node**,
tree_node**, tree_node**, int, bool, bool, tree_node**)
../../gcc/tree-vect-loop-manip.cc:3699
0x1746086 vect_transform_loop(_loop_vec_info*, gimple*)
../../gcc/tree-vect-loop.cc:11517
0x17b5038 vect_transform_loops
../../gcc/tree-vectorizer.cc:1042
- `-O3` and `-O2 -ftree-loop-vectorize` ICE; `-O1`, `-O2`, `-Os` compile fine.
- `-O3 -fno-tree-loop-vectorize` and `-O3 -fno-tree-dominator-opts` compile
fine.
- A release-checking build needs `-fchecking`; it then reports the same
"dominator of ... should be ..." error and bails out.
The ICE is in the vectorizer's loop peeling: after
`slpeel_tree_duplicate_loop_to_edge_cfg` copies the loop for the epilogue, the
dominator verifier finds a wrong immediate dominator. The loop stores a 7-bit
bit-field of a `_BitInt(13)` and a `_BitInt(255)` member through two different
strides (`p[i]` and `p[x * i]`).
## Cause
**Bisected to r17-4892** (58294ebfb40, "DOM: replace simplify_binary_operation
with the ranger", Aldy Hernandez, 2026-10-04):
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=58294ebfb40b05e1e4624006a8c5479293d398ec
C-only builds of the two commits (`--enable-checking=release`, testcase
compiled with `-O3 -fchecking`):
| Commit | repro.c -O3 -fchecking |
|---|---|
| 16fdba15386 (parent of r17-4892) | ok |
| **58294ebfb40 (r17-4892) "DOM: replace simplify_binary_operation with the
ranger"** | **error: dominator of 14 should be 3, not 15** |
r17-4892 changes what DOM simplifies before the vectorizer runs;
`-fno-tree-dominator-opts` avoids the ICE. The failing check is in the
vectorizer's peeling code, so the DOM change may only expose a latent problem
in the CFG update of `slpeel_tree_duplicate_loop_to_edge_cfg` for this loop
shape.
## Checked versions
- gcc trunk c10b819941b (2026-11-30, `--enable-checking=yes`): ICE at -O3 and
at -O2 -ftree-loop-vectorize; -O1, -O2, -Os ok.
- gcc 16.2, 16.1, 15.2, 14.3: ok at -O3.
Godbolt (gcc trunk, -O3 ICE): https://godbolt.org/z/j4M1oEj35
Thanks.