On Thu, Nov 12, 2026 at 10:20:54AM +0100, Jakub Jelinek wrote:
> Is it unsafe to call fold_non_dependent_expr during module reading?
> If yes, maybe I should do
> tree ret = make_node (BITINT_TYPE);
> TYPE_PRECISION (ret) = 0;
> TYPE_UNSIGNED (ret) = unsignedp;
> BITINT_PREC (ret) = prec;
> SET_TYPE_STRUCTURAL_EQUALITY (ret);
> manually when streaming a dependent BITINT_TYPE instead of calling
> finish_bitint.
Incremental patch below fixes all those ICEs.
--- a/gcc/cp/module.cc 2026-11-11 21:39:04.601972690 +0100
+++ b/gcc/cp/module.cc 2026-11-12 10:31:26.357957754 +0100
@@ -10627,9 +10627,18 @@ trees_in::tree_node (bool is_use)
tree prec = tree_node ();
unsigned enc = u ();
if (!get_overrun ())
- res = finish_bitint (UNKNOWN_LOCATION,
- (enc & ~1) ? size_int (enc >> 1) : prec,
- enc & 1, tf_none);
+ {
+ if ((enc & ~1) != 0)
+ res = build_bitint_type (enc >> 1, enc & 1);
+ else
+ {
+ res = make_node (BITINT_TYPE);
+ TYPE_PRECISION (res) = 0;
+ TYPE_UNSIGNED (res) = enc & 1;
+ BITINT_PREC (res) = prec;
+ SET_TYPE_STRUCTURAL_EQUALITY (res);
+ }
+ }
}
break;
Jakub