public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/112941] New: during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt()
@ 2023-12-09 14:26 zsojka at seznam dot cz
  2023-12-09 23:39 ` [Bug tree-optimization/112941] " pinskia at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: zsojka at seznam dot cz @ 2023-12-09 14:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112941

            Bug ID: 112941
           Summary: during GIMPLE pass: bitintlower ICE: in
                    handle_operand_addr, at gimple-lower-bitint.cc:2126
                    (gimple-lower-bitint.cc:2134) at -O with _BitInt()
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

Created attachment 56841
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56841&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc -O testcase.c
during GIMPLE pass: bitintlower
testcase.c: In function 'foo':
testcase.c:7:1: internal compiler error: in handle_operand_addr, at
gimple-lower-bitint.cc:2134
    7 | foo (void)
      | ^~~
0xd644e2 handle_operand_addr
        /repo/gcc-trunk/gcc/gimple-lower-bitint.cc:2134
0x25c9e8f lower_muldiv_stmt
        /repo/gcc-trunk/gcc/gimple-lower-bitint.cc:3340
0x25dd546 gimple_lower_bitint
        /repo/gcc-trunk/gcc/gimple-lower-bitint.cc:6401
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r14-6356-20231209102837-g36be2a0e91c-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --with-cloog --with-ppl --with-isl
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r14-6356-20231209102837-g36be2a0e91c-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.0 20231209 (experimental) (GCC)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/112941] during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt()
  2023-12-09 14:26 [Bug tree-optimization/112941] New: during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt() zsojka at seznam dot cz
@ 2023-12-09 23:39 ` pinskia at gcc dot gnu.org
  2023-12-13 20:03 ` zsojka at seznam dot cz
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-12-09 23:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112941

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-12-09
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

Slightly more reduced:
```
_BitInt (2049) b2049;
unsigned _BitInt (6384) b16384;

void
foo (signed char t)
{
  b2049 = b16384 * t;
}

```

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/112941] during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt()
  2023-12-09 14:26 [Bug tree-optimization/112941] New: during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt() zsojka at seznam dot cz
  2023-12-09 23:39 ` [Bug tree-optimization/112941] " pinskia at gcc dot gnu.org
@ 2023-12-13 20:03 ` zsojka at seznam dot cz
  2023-12-14 15:41 ` jakub at gcc dot gnu.org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: zsojka at seznam dot cz @ 2023-12-13 20:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112941

--- Comment #2 from Zdenek Sojka <zsojka at seznam dot cz> ---
(In reply to Andrew Pinski from comment #1)
> Confirmed.
> 
> Slightly more reduced:
> ```
> _BitInt (2049) b2049;
> unsigned _BitInt (6384) b16384;
> 
> void
> foo (signed char t)
> {
>   b2049 = b16384 * t;
> }
> 
> ```

Thank you for the further reduction.
In the original testcase, foo() and bar() trigger different ICE ( :2126 and
:2134 )

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/112941] during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt()
  2023-12-09 14:26 [Bug tree-optimization/112941] New: during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt() zsojka at seznam dot cz
  2023-12-09 23:39 ` [Bug tree-optimization/112941] " pinskia at gcc dot gnu.org
  2023-12-13 20:03 ` zsojka at seznam dot cz
@ 2023-12-14 15:41 ` jakub at gcc dot gnu.org
  2023-12-15 10:19 ` jakub at gcc dot gnu.org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-14 15:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112941

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Simplified:
unsigned _BitInt(2049)
foo (unsigned _BitInt(6384) x, _BitInt(8) y)
{
  return x * y;
}

_BitInt(2049)
bar (unsigned _BitInt(6384) x, _BitInt(1023) y)
{
  return x * y;
}

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/112941] during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt()
  2023-12-09 14:26 [Bug tree-optimization/112941] New: during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt() zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2023-12-14 15:41 ` jakub at gcc dot gnu.org
@ 2023-12-15 10:19 ` jakub at gcc dot gnu.org
  2023-12-15 11:07 ` jakub at gcc dot gnu.org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-15 10:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112941

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
And after the PR113024 changes, one needs -O1 -fno-tree-forwprop on:
unsigned _BitInt(2049)
foo (unsigned _BitInt(6384) x, _BitInt(8) y)
{
  unsigned _BitInt(6384) z = y;
  return x * z;
}

_BitInt(2049)
bar (unsigned _BitInt(6384) x, _BitInt(1023) y)
{
  unsigned _BitInt(6384) z = y;
  return x * z;
}
to reproduce it.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/112941] during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt()
  2023-12-09 14:26 [Bug tree-optimization/112941] New: during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt() zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2023-12-15 10:19 ` jakub at gcc dot gnu.org
@ 2023-12-15 11:07 ` jakub at gcc dot gnu.org
  2023-12-15 12:33 ` jakub at gcc dot gnu.org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-15 11:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112941

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Testcase covering various cases where 2 consecutive casts can't be optimized
away.
This ICEs in multiple ways as well:
void
f1 (_BitInt(4096) *p, int r, _BitInt(115) s, _BitInt(128) t, _BitInt(231) u)
{
  p[0] += (unsigned _BitInt(2048)) r;
  p[1] += (unsigned _BitInt(2048)) s;
  p[2] += (unsigned _BitInt(2048)) t;
  p[3] += (unsigned _BitInt(2048)) u;
}

void
f2 (_BitInt(4096) *p, int r, _BitInt(115) s, _BitInt(128) t, _BitInt(231) u)
{
  p[0] *= (unsigned _BitInt(2048)) r;
  p[1] *= (unsigned _BitInt(2048)) s;
  p[2] *= (unsigned _BitInt(2048)) t;
  p[3] *= (unsigned _BitInt(2048)) u;
}

void
f3 (_BitInt(4096) *p, int r, _BitInt(115) s, _BitInt(128) t, _BitInt(231) u)
{
  p[0] += (unsigned _BitInt(2110)) r;
  p[1] += (unsigned _BitInt(2110)) s;
  p[2] += (unsigned _BitInt(2110)) t;
  p[3] += (unsigned _BitInt(2110)) u;
}

void
f4 (_BitInt(4096) *p, int r, _BitInt(115) s, _BitInt(128) t, _BitInt(231) u)
{
  p[0] *= (unsigned _BitInt(2110)) r;
  p[1] *= (unsigned _BitInt(2110)) s;
  p[2] *= (unsigned _BitInt(2110)) t;
  p[3] *= (unsigned _BitInt(2110)) u;
}

void
f5 (unsigned _BitInt(4096) *p, int r, _BitInt(115) s, _BitInt(128) t,
_BitInt(231) u)
{
  p[0] += (unsigned _BitInt(2048)) r;
  p[1] += (unsigned _BitInt(2048)) s;
  p[2] += (unsigned _BitInt(2048)) t;
  p[3] += (unsigned _BitInt(2048)) u;
}

void
f6 (unsigned _BitInt(4096) *p, int r, _BitInt(115) s, _BitInt(128) t,
_BitInt(231) u)
{
  p[0] *= (unsigned _BitInt(2048)) r;
  p[1] *= (unsigned _BitInt(2048)) s;
  p[2] *= (unsigned _BitInt(2048)) t;
  p[3] *= (unsigned _BitInt(2048)) u;
}

void
f7 (unsigned _BitInt(4096) *p, int r, _BitInt(115) s, _BitInt(128) t,
_BitInt(231) u)
{
  p[0] += (unsigned _BitInt(2110)) r;
  p[1] += (unsigned _BitInt(2110)) s;
  p[2] += (unsigned _BitInt(2110)) t;
  p[3] += (unsigned _BitInt(2110)) u;
}

void
f8 (unsigned _BitInt(4096) *p, int r, _BitInt(115) s, _BitInt(128) t,
_BitInt(231) u)
{
  p[0] *= (unsigned _BitInt(2110)) r;
  p[1] *= (unsigned _BitInt(2110)) s;
  p[2] *= (unsigned _BitInt(2110)) t;
  p[3] *= (unsigned _BitInt(2110)) u;
}

#if __SIZEOF_INT128__
void
f9 (_BitInt(4096) *p, __int128 r)
{
  p[0] += (unsigned _BitInt(2048)) r;
}

void
f10 (_BitInt(4096) *p, __int128 r)
{
  p[0] *= (unsigned _BitInt(2048)) r;
}

void
f11 (_BitInt(4096) *p, __int128 r)
{
  p[0] += (unsigned _BitInt(2110)) r;
}

void
f12 (_BitInt(4096) *p, __int128 r)
{
  p[0] *= (unsigned _BitInt(2110)) r;
}

void
f13 (unsigned _BitInt(4096) *p, __int128 r)
{
  p[0] += (unsigned _BitInt(2048)) r;
}

void
f14 (unsigned _BitInt(4096) *p, __int128 r)
{
  p[0] *= (unsigned _BitInt(2048)) r;
}

void
f15 (unsigned _BitInt(4096) *p, __int128 r)
{
  p[0] += (unsigned _BitInt(2110)) r;
}

void
f16 (unsigned _BitInt(4096) *p, __int128 r)
{
  p[0] *= (unsigned _BitInt(2110)) r;
}
#endif

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/112941] during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt()
  2023-12-09 14:26 [Bug tree-optimization/112941] New: during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt() zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2023-12-15 11:07 ` jakub at gcc dot gnu.org
@ 2023-12-15 12:33 ` jakub at gcc dot gnu.org
  2023-12-20 10:34 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-15 12:33 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112941

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
And another testcase which ICEs:
unsigned _BitInt(495) f1 (signed _BitInt(381) x) { unsigned _BitInt(539) y = x;
return y; }
unsigned _BitInt(495) f2 (unsigned _BitInt(381) x) { unsigned _BitInt(539) y =
x; return y; }
unsigned _BitInt(495) f3 (signed _BitInt(381) x) { _BitInt(539) y = x; return
y; }
unsigned _BitInt(495) f4 (unsigned _BitInt(381) x) { _BitInt(539) y = x; return
y; }
_BitInt(495) f5 (signed _BitInt(381) x) { unsigned _BitInt(539) y = x; return
y; }
_BitInt(495) f6 (unsigned _BitInt(381) x) { unsigned _BitInt(539) y = x; return
y; }
_BitInt(495) f7 (signed _BitInt(381) x) { _BitInt(539) y = x; return y; }
_BitInt(495) f8 (unsigned _BitInt(381) x) { _BitInt(539) y = x; return y; }
unsigned _BitInt(495) f9 (signed _BitInt(381) x) { return (unsigned
_BitInt(539)) x; }
unsigned _BitInt(495) f10 (unsigned _BitInt(381) x) { return (unsigned
_BitInt(539)) x; }
unsigned _BitInt(495) f11 (signed _BitInt(381) x) { return (_BitInt(539)) x; }
unsigned _BitInt(495) f12 (unsigned _BitInt(381) x) { return (_BitInt(539)) x;
}
_BitInt(495) f13 (signed _BitInt(381) x) { return (unsigned _BitInt(539)) x; }
_BitInt(495) f14 (unsigned _BitInt(381) x) { return (unsigned _BitInt(539)) x;
}
_BitInt(495) f15 (signed _BitInt(381) x) { return (_BitInt(539)) x; }
_BitInt(495) f16 (unsigned _BitInt(381) x) { return (_BitInt(539)) x; }

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/112941] during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt()
  2023-12-09 14:26 [Bug tree-optimization/112941] New: during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt() zsojka at seznam dot cz
                   ` (5 preceding siblings ...)
  2023-12-15 12:33 ` jakub at gcc dot gnu.org
@ 2023-12-20 10:34 ` cvs-commit at gcc dot gnu.org
  2023-12-20 13:20 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-20 10:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112941

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

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

commit r14-6742-gbe9e8de628471399ee5abb1e6ba7738139256b67
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Dec 20 11:32:52 2023 +0100

    lower-bitint: Fix up handling of nested casts in mergeable stmt handling
[PR112941]

    The following patch fixes 2 issues in handling of casts for mergeable
    stmts.
    The first hunk fixes the case when we have two nested casts (typically
    after optimization that is zero-extension of a sign-extension because
    everything else should have been folded into a single cast).  If
    the lowering of the outer cast needs to make the code conditional
    (e.g.
      for (...)
        {
          if (idx <= 32)
            {
              if (idx < 32)
                { ... handle_operand (idx); ... }
              else
                { ... handle_operand (32); ... }
            }
          ...
        }
    ) and the lowering of the inner one as well, right now it creates invalid
    SSA form, because even for the inner cast we need a PHI on the loop
    and the PHI argument from the latch edge is a SSA_NAME initialized in
    the conditionally executed bb.  The hunk fixes that by detecting such
    a case and adding further PHI nodes at the end of the ifs such that
    the right value propagates to the next loop iteration.  We can use
    0 arguments for the other edges because the inner operand handling
    is only done for the first set of iterations and then the other ifs take
    over.

    The rest fixes a case of again invalid SSA form, when for a sign extension
    we need to use the 0 or -1 value initialized by earlier iteration in
    a constant idx case, the code was using the value of the loop PHI argument
    from latch edge rather than result; that is correct for cases expanded
    in straight line code after the loop, but not inside of the loop for the
    cases of handle_cast conditionals, there we should use PHI result.  This
    is done in the second hunk and supported by the remaining hunks, where
    it clears m_bb to tell the code we aren't in the loop anymore.

    Note, this patch doesn't deal with similar problems during multiplication,
    division, floating casts etc. where we just emit a library call.  I'll
    need to make sure in that case we don't merge more than one cast per
    operand.

    2023-12-20  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/112941
            * gimple-lower-bitint.cc (bitint_large_huge::handle_cast): If
            save_cast_conditional, instead of adding assignment of t4 to
            m_data[save_data_cnt + 1] before m_gsi, add phi nodes such that
            t4 propagates to m_bb loop.  For constant idx, use
            m_data[save_data_cnt] rather than m_data[save_data_cnt + 1] if
inside
            of the m_bb loop.
            (bitint_large_huge::lower_mergeable_stmt): Clear m_bb when no
longer
            expanding inside of that loop.
            (bitint_large_huge::lower_comparison_stmt): Likewise.
            (bitint_large_huge::lower_addsub_overflow): Likewise.
            (bitint_large_huge::lower_mul_overflow): Likewise.
            (bitint_large_huge::lower_bit_query): Likewise.

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/112941] during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt()
  2023-12-09 14:26 [Bug tree-optimization/112941] New: during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt() zsojka at seznam dot cz
                   ` (6 preceding siblings ...)
  2023-12-20 10:34 ` cvs-commit at gcc dot gnu.org
@ 2023-12-20 13:20 ` jakub at gcc dot gnu.org
  2023-12-20 14:42 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-20 13:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112941

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 56910
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56910&action=edit
gcc14-pr112941-mul.patch

Patch to punt merging of nested casts in mul/div/mod/float operands.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/112941] during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt()
  2023-12-09 14:26 [Bug tree-optimization/112941] New: during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt() zsojka at seznam dot cz
                   ` (7 preceding siblings ...)
  2023-12-20 13:20 ` jakub at gcc dot gnu.org
@ 2023-12-20 14:42 ` jakub at gcc dot gnu.org
  2023-12-21 10:14 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-20 14:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112941

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
*** Bug 113015 has been marked as a duplicate of this bug. ***

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/112941] during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt()
  2023-12-09 14:26 [Bug tree-optimization/112941] New: during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt() zsojka at seznam dot cz
                   ` (8 preceding siblings ...)
  2023-12-20 14:42 ` jakub at gcc dot gnu.org
@ 2023-12-21 10:14 ` cvs-commit at gcc dot gnu.org
  2023-12-21 16:50 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-21 10:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112941

--- Comment #10 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:3d1bdbf64c2ed5be70fbff687b2927e328297b81

commit r14-6777-g3d1bdbf64c2ed5be70fbff687b2927e328297b81
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Dec 21 11:13:42 2023 +0100

    lower-bitint: Avoid nested casts in muldiv/float operands [PR112941]

    Multiplication/division/modulo/float operands are handled by libgcc calls
    and so need to be passed as array of limbs with precision argument,
    using handle_operand_addr.  That code can't deal with more than one cast,
    so the following patch avoids merging those cases.
    .MUL_OVERFLOW calls use the same code, but we don't actually try to merge
    the operands in that case already.

    2023-12-21  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/112941
            * gimple-lower-bitint.cc (gimple_lower_bitint): Disallow merging
            a cast with multiplication, division or conversion to floating
point
            if rhs1 of the cast is result of another single use cast in the
same
            bb.

            * gcc.dg/bitint-56.c: New test.
            * gcc.dg/bitint-57.c: New test.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/112941] during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt()
  2023-12-09 14:26 [Bug tree-optimization/112941] New: during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt() zsojka at seznam dot cz
                   ` (9 preceding siblings ...)
  2023-12-21 10:14 ` cvs-commit at gcc dot gnu.org
@ 2023-12-21 16:50 ` jakub at gcc dot gnu.org
  2023-12-22 11:30 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-12-21 16:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112941

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 56920
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56920&action=edit
gcc14-pr112941-thunk.patch

Untested patch for the #c6 ICE.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/112941] during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt()
  2023-12-09 14:26 [Bug tree-optimization/112941] New: during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt() zsojka at seznam dot cz
                   ` (10 preceding siblings ...)
  2023-12-21 16:50 ` jakub at gcc dot gnu.org
@ 2023-12-22 11:30 ` cvs-commit at gcc dot gnu.org
  2024-01-03  9:17 ` jakub at gcc dot gnu.org
  2024-01-20 17:11 ` pinskia at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-22 11:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112941

--- Comment #12 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:0a6aa1927597d821a85bc3d1fd7682256c25b548

commit r14-6805-g0a6aa1927597d821a85bc3d1fd7682256c25b548
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Dec 22 12:28:54 2023 +0100

    symtab-thunks: Use aggregate_value_p even on is_gimple_reg_type returns
[PR112941]

    Large/huge _BitInt types are returned in memory and the bitint lowering
    pass right now relies on that.
    The gimplification etc. use aggregate_value_p to see if it should be
    returned in memory or not and use
      <retval> = _123;
      return <retval>;
    rather than
      return _123;
    But expand_thunk used e.g. by IPA-ICF was performing an optimization,
    assuming is_gimple_reg_type is always passed in registers and not calling
    aggregate_value_p in that case.  The following patch changes it to match
    what the gimplification etc. are doing.

    2023-12-22  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/112941
            * symtab-thunks.cc (expand_thunk): Check aggregate_value_p
regardless
            of whether is_gimple_reg_type (restype) or not.

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

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/112941] during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt()
  2023-12-09 14:26 [Bug tree-optimization/112941] New: during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt() zsojka at seznam dot cz
                   ` (11 preceding siblings ...)
  2023-12-22 11:30 ` cvs-commit at gcc dot gnu.org
@ 2024-01-03  9:17 ` jakub at gcc dot gnu.org
  2024-01-20 17:11 ` pinskia at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-03  9:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112941

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug tree-optimization/112941] during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt()
  2023-12-09 14:26 [Bug tree-optimization/112941] New: during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt() zsojka at seznam dot cz
                   ` (12 preceding siblings ...)
  2024-01-03  9:17 ` jakub at gcc dot gnu.org
@ 2024-01-20 17:11 ` pinskia at gcc dot gnu.org
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-20 17:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112941

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-01-20 17:11 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-09 14:26 [Bug tree-optimization/112941] New: during GIMPLE pass: bitintlower ICE: in handle_operand_addr, at gimple-lower-bitint.cc:2126 (gimple-lower-bitint.cc:2134) at -O with _BitInt() zsojka at seznam dot cz
2023-12-09 23:39 ` [Bug tree-optimization/112941] " pinskia at gcc dot gnu.org
2023-12-13 20:03 ` zsojka at seznam dot cz
2023-12-14 15:41 ` jakub at gcc dot gnu.org
2023-12-15 10:19 ` jakub at gcc dot gnu.org
2023-12-15 11:07 ` jakub at gcc dot gnu.org
2023-12-15 12:33 ` jakub at gcc dot gnu.org
2023-12-20 10:34 ` cvs-commit at gcc dot gnu.org
2023-12-20 13:20 ` jakub at gcc dot gnu.org
2023-12-20 14:42 ` jakub at gcc dot gnu.org
2023-12-21 10:14 ` cvs-commit at gcc dot gnu.org
2023-12-21 16:50 ` jakub at gcc dot gnu.org
2023-12-22 11:30 ` cvs-commit at gcc dot gnu.org
2024-01-03  9:17 ` jakub at gcc dot gnu.org
2024-01-20 17:11 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).