]> git.ipfire.org Git - thirdparty/gcc.git/commit
builtins: Handle BITINT_TYPE in __builtin_iseqsig folding [PR117802]
authorJakub Jelinek <jakub@redhat.com>
Thu, 28 Nov 2024 09:23:47 +0000 (10:23 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 28 Nov 2024 09:23:47 +0000 (10:23 +0100)
commit88aeea14c23a5d066a635ffb4f1d2943fddcf0bd
tree26d7f259ba4a2af19c93e854fae833cd93664c6d
parent24dac1eab9c3b650826bbaa84dd64310910e647c
builtins: Handle BITINT_TYPE in __builtin_iseqsig folding [PR117802]

In check_builtin_function_arguments in the _BitInt patchset I've changed
INTEGER_TYPE tests to INTEGER_TYPE or BITINT_TYPE, but haven't done the
same in fold_builtin_iseqsig, which now ICEs because of that.

The following patch fixes that.

BTW, that TYPE_PRECISION (type0) >= TYPE_PRECISION (type1) test
for REAL_TYPE vs. REAL_TYPE looks pretty random and dangerous, I think
it would be useful to handle this builtin also in the C and C++ FEs,
if both arguments have REAL_TYPE, use the FE specific routine to decide
which types to use and error if a comparison between types would be
erroneous (e.g. complain about _Decimal* vs. float/double/long
double/_Float*, pick up the preferred type, complain about
__ibm128 vs. _Float128 in C++, etc.).
But the FEs can just promote one argument to the other in that case
and keep fold_builtin_iseqsig as is for say Fortran and other FEs.

2024-11-28  Jakub Jelinek  <jakub@redhat.com>

PR c/117802
* builtins.cc (fold_builtin_iseqsig): Handle BITINT_TYPE like
INTEGER_TYPE.

* gcc.dg/builtin-iseqsig-1.c: New test.
* gcc.dg/bitint-118.c: New test.
gcc/builtins.cc
gcc/testsuite/gcc.dg/bitint-118.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-iseqsig-1.c [new file with mode: 0644]