[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] VN: Fix VN ICE for large _BitInt types
Jeff Law
law@gcc.gnu.org
Fri Jan 30 07:16:48 GMT 2026
https://gcc.gnu.org/g:a04729d734f7492e495a64bfbe631683518dbd26
commit a04729d734f7492e495a64bfbe631683518dbd26
Author: Kito Cheng <kito.cheng@sifive.com>
Date: Mon Dec 29 14:14:25 2025 +0800
VN: Fix VN ICE for large _BitInt types
gcc.dg/torture/bitint-18.c triggers an ICE in push_partial_def when
compiling for RISC-V with -O2. The issue occurs because
build_nonstandard_integer_type cannot handle bit widths larger than
MAX_FIXED_MODE_SIZE.
For BITINT_TYPE with maxsizei > MAX_FIXED_MODE_SIZE, use build_bitint_type
instead of build_nonstandard_integer_type, similar to what tree-sra.cc does.
gcc/ChangeLog:
* tree-ssa-sccvn.cc (vn_walk_cb_data::push_partial_def): Use
build_bitint_type for BITINT_TYPE when maxsizei exceeds
MAX_FIXED_MODE_SIZE.
(cherry picked from commit cbb9d3815201cfb8869140fc80f0cee19f004a3f)
Diff:
---
gcc/tree-ssa-sccvn.cc | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
index 9d679824eaf5..efd67df07bc4 100644
--- a/gcc/tree-ssa-sccvn.cc
+++ b/gcc/tree-ssa-sccvn.cc
@@ -2315,7 +2315,13 @@ vn_walk_cb_data::push_partial_def (pd_data pd,
/* Make sure to interpret in a type that has a range covering the whole
access size. */
if (INTEGRAL_TYPE_P (vr->type) && maxsizei != TYPE_PRECISION (vr->type))
- type = build_nonstandard_integer_type (maxsizei, TYPE_UNSIGNED (type));
+ {
+ if (TREE_CODE (vr->type) == BITINT_TYPE
+ && maxsizei > MAX_FIXED_MODE_SIZE)
+ type = build_bitint_type (maxsizei, TYPE_UNSIGNED (type));
+ else
+ type = build_nonstandard_integer_type (maxsizei, TYPE_UNSIGNED (type));
+ }
tree val;
if (BYTES_BIG_ENDIAN)
{
More information about the Gcc-cvs
mailing list