https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83182
--- Comment #1 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> --- wi::to_offset does check for an INTEGER_CST, via the tree.h accessor macros. Are you sure you have a normal --enable-checking=yes build? I get: cc1: internal compiler error: tree check: expected integer_cst, have trunc_div_expr in get_len, at tree.h:5315 with the quoted example. But yeah, I've certainly no objection in principle to extra gcc_checking_asserts in wide-int.h itself.