https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113297
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jamborm at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I'm afraid I don't know enough about SRA, obviously using build_nonstandard_integer_type is invalid when the precision (root->size in this case) is too large. --- gcc/tree-sra.cc.jj 2024-01-03 11:51:35.054682295 +0100 +++ gcc/tree-sra.cc 2024-01-09 19:50:42.911500487 +0100 @@ -2733,7 +2733,8 @@ analyze_access_subtree (struct access *r For integral types this means the precision has to match. Avoid assumptions based on the integral type kind, too. */ if (INTEGRAL_TYPE_P (root->type) - && (TREE_CODE (root->type) != INTEGER_TYPE + && ((TREE_CODE (root->type) != INTEGER_TYPE + && TREE_CODE (root->type) != BITINT_TYPE) || TYPE_PRECISION (root->type) != root->size) /* But leave bitfield accesses alone. */ && (TREE_CODE (root->expr) != COMPONENT_REF @@ -2742,8 +2743,11 @@ analyze_access_subtree (struct access *r tree rt = root->type; gcc_assert ((root->offset % BITS_PER_UNIT) == 0 && (root->size % BITS_PER_UNIT) == 0); - root->type = build_nonstandard_integer_type (root->size, - TYPE_UNSIGNED (rt)); + if (TREE_CODE (root->type) == BITINT_TYPE) + root->type = build_bitint_type (root->size, TYPE_UNSIGNED (rt)); + else + root->type = build_nonstandard_integer_type (root->size, + TYPE_UNSIGNED (rt)); root->expr = build_ref_for_offset (UNKNOWN_LOCATION, root->base, root->offset, root->reverse, root->type, NULL, false); fixes the ICE and obviously for original BITINT_TYPE we probably want to use BITINT_TYPE, for non-BITINT_TYPE INTEGER_TYPE. But it is unclear if the above can't run into unsupportable cases, either if root->size would be too small (BITINT_TYPE is only supported for precision 2 and above if signed, there is no signed _BitInt(1)) and more importantly on the other boundary. __BITINT_MAXWIDTH__ is right now (on x86-64 where it is only supported for now) 65535 bits, so {,un}signed _BitInt(65535) is valid, but not _BitInt(65536). As the above code doesn't have some clear way to punt, I think something else needs to punt instead of trying to build something for root->size 65536 - TYPE_PRECISION is only 16-bit, so we can't have TYPE_PRECISION 65536...