[Bug tree-optimization/121127] ICE at O2: in handle_operand_addr, at gimple-lower-bitint.cc:2525 with an uninitialized _BitInt and multiply

2025-08-08 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121127

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
   Target Milestone|--- |14.4
 Resolution|--- |FIXED

--- Comment #6 from Jakub Jelinek  ---
Fixed for 16+, 15.3+ and 14.4+.

[Bug tree-optimization/121127] ICE at O2: in handle_operand_addr, at gimple-lower-bitint.cc:2525 with an uninitialized _BitInt and multiply

2025-08-08 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121127

--- Comment #5 from GCC Commits  ---
The releases/gcc-14 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:cde5db5178169cff91c4f5b0f4b7d7bad6dff33a

commit r14-11940-gcde5db5178169cff91c4f5b0f4b7d7bad6dff33a
Author: Jakub Jelinek 
Date:   Wed Aug 6 11:28:37 2025 +0200

bitint: Fix up handling of uninitialized mul/div/float cast operands
[PR121127]

handle_operand_addr (used for the cases where we use libgcc APIs, so
multiplication, division, modulo, casts of _BitInt to float/dfp) when it
sees default definition of an SSA_NAME which is not PARM_DECL (i.e.
uninitialized one) just allocates single uninitialized limb, there is no
need to waste more memory on it, it can just tell libgcc that it has
64-bit precision, not say 1024 bit etc.
Unfortunately, doing this runs into some asserts when we have a narrowing
cast of the uninitialized SSA_NAME (but still large/huge _BitInt).

The following patch fixes that by using a magic value in *prec_stored
for the uninitialized cases (0) and just don't do any *prec tweaks for
narrowing casts from that.  precs still needs to be maintained as before,
that one is used for big endian adjustment.

2025-08-06  Jakub Jelinek  

PR tree-optimization/121127
* gimple-lower-bitint.cc (bitint_large_huge::handle_operand_addr):
For
uninitialized SSA_NAME, set *prec_stored to 0 rather than *prec.
Handle that case in narrowing casts.  If prec_stored is non-NULL,
set *prec_stored to prec_stored_val.

* gcc.dg/bitint-125.c: New test.

(cherry picked from commit d175a6b119b8ab177ab9d9fb81dcac1794d18ad6)

[Bug tree-optimization/121127] ICE at O2: in handle_operand_addr, at gimple-lower-bitint.cc:2525 with an uninitialized _BitInt and multiply

2025-08-08 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121127

--- Comment #4 from GCC Commits  ---
The releases/gcc-15 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:332e891a8a42a9ba971174c8282864fbc1976b7f

commit r15-10205-g332e891a8a42a9ba971174c8282864fbc1976b7f
Author: Jakub Jelinek 
Date:   Wed Aug 6 11:28:37 2025 +0200

bitint: Fix up handling of uninitialized mul/div/float cast operands
[PR121127]

handle_operand_addr (used for the cases where we use libgcc APIs, so
multiplication, division, modulo, casts of _BitInt to float/dfp) when it
sees default definition of an SSA_NAME which is not PARM_DECL (i.e.
uninitialized one) just allocates single uninitialized limb, there is no
need to waste more memory on it, it can just tell libgcc that it has
64-bit precision, not say 1024 bit etc.
Unfortunately, doing this runs into some asserts when we have a narrowing
cast of the uninitialized SSA_NAME (but still large/huge _BitInt).

The following patch fixes that by using a magic value in *prec_stored
for the uninitialized cases (0) and just don't do any *prec tweaks for
narrowing casts from that.  precs still needs to be maintained as before,
that one is used for big endian adjustment.

2025-08-06  Jakub Jelinek  

PR tree-optimization/121127
* gimple-lower-bitint.cc (bitint_large_huge::handle_operand_addr):
For
uninitialized SSA_NAME, set *prec_stored to 0 rather than *prec.
Handle that case in narrowing casts.  If prec_stored is non-NULL,
set *prec_stored to prec_stored_val.

* gcc.dg/bitint-125.c: New test.

(cherry picked from commit d175a6b119b8ab177ab9d9fb81dcac1794d18ad6)

[Bug tree-optimization/121127] ICE at O2: in handle_operand_addr, at gimple-lower-bitint.cc:2525 with an uninitialized _BitInt and multiply

2025-08-06 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121127

--- Comment #3 from GCC Commits  ---
The master branch has been updated by Jakub Jelinek :

https://gcc.gnu.org/g:d175a6b119b8ab177ab9d9fb81dcac1794d18ad6

commit r16-3033-gd175a6b119b8ab177ab9d9fb81dcac1794d18ad6
Author: Jakub Jelinek 
Date:   Wed Aug 6 11:28:37 2025 +0200

bitint: Fix up handling of uninitialized mul/div/float cast operands
[PR121127]

handle_operand_addr (used for the cases where we use libgcc APIs, so
multiplication, division, modulo, casts of _BitInt to float/dfp) when it
sees default definition of an SSA_NAME which is not PARM_DECL (i.e.
uninitialized one) just allocates single uninitialized limb, there is no
need to waste more memory on it, it can just tell libgcc that it has
64-bit precision, not say 1024 bit etc.
Unfortunately, doing this runs into some asserts when we have a narrowing
cast of the uninitialized SSA_NAME (but still large/huge _BitInt).

The following patch fixes that by using a magic value in *prec_stored
for the uninitialized cases (0) and just don't do any *prec tweaks for
narrowing casts from that.  precs still needs to be maintained as before,
that one is used for big endian adjustment.

2025-08-06  Jakub Jelinek  

PR tree-optimization/121127
* gimple-lower-bitint.cc (bitint_large_huge::handle_operand_addr):
For
uninitialized SSA_NAME, set *prec_stored to 0 rather than *prec.
Handle that case in narrowing casts.  If prec_stored is non-NULL,
set *prec_stored to prec_stored_val.

* gcc.dg/bitint-125.c: New test.

[Bug tree-optimization/121127] ICE at O2: in handle_operand_addr, at gimple-lower-bitint.cc:2525 with an uninitialized _BitInt and multiply

2025-08-05 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121127

Jakub Jelinek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek  ---
Created attachment 62058
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62058&action=edit
gcc16-pr121127.patch

So far lightly tested patch.

[Bug tree-optimization/121127] ICE at O2: in handle_operand_addr, at gimple-lower-bitint.cc:2525 with an uninitialized _BitInt and multiply

2025-07-16 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121127

Andrew Pinski  changed:

   What|Removed |Added

  Component|c   |tree-optimization
Summary|ICE at O2: in   |ICE at O2: in
   |handle_operand_addr, at |handle_operand_addr, at
   |gimple-lower-bitint.cc:2525 |gimple-lower-bitint.cc:2525
   ||with an uninitialized
   ||_BitInt and multiply
   Keywords||ice-on-valid-code
 Ever confirmed|0   |1
 Target||x86_64 aarch64
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2025-07-16
  Known to fail||14.1.0

--- Comment #1 from Andrew Pinski  ---
Confirmed.