]> git.ipfire.org Git - thirdparty/gcc.git/commit
gimple-fold: Fix the recent ifcombine optimization for _BitInt [PR118023]
authorJakub Jelinek <jakub@redhat.com>
Sat, 14 Dec 2024 10:28:25 +0000 (11:28 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 14 Dec 2024 10:28:25 +0000 (11:28 +0100)
commit7f4e85a954d24cc30bf85f4040fcd204bd5e23fd
treeffbb3eff140796af4c6c682184f006cc82990866
parent9537ca5ad9bc23d7e9c446b4a7cbb98f63bddb6a
gimple-fold: Fix the recent ifcombine optimization for _BitInt [PR118023]

The BIT_FIELD_REF verifier has:
          if (INTEGRAL_TYPE_P (TREE_TYPE (op))
              && !type_has_mode_precision_p (TREE_TYPE (op)))
            {
              error ("%qs of non-mode-precision operand", code_name);
              return true;
            }
check among other things, so one can't extract something out of say
_BitInt(63) or _BitInt(4096).
The new ifcombine optimization happily creates such BIT_FIELD_REFs
and ICEs during their verification.

The following patch fixes that by rejecting those in decode_field_reference.

2024-12-14  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/118023
* gimple-fold.cc (decode_field_reference): Return NULL_TREE if
inner has non-type_has_mode_precision_p integral type.

* gcc.dg/bitint-119.c: New test.
gcc/gimple-fold.cc
gcc/testsuite/gcc.dg/bitint-119.c [new file with mode: 0644]