public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/113567] New: ICE: SSA corruption: Unable to coalesce ssa_names 1 and 3 which are marked as MUST COALESCE. with _BitInt() and computed goto
@ 2024-01-23 19:50 zsojka at seznam dot cz
  2024-01-23 20:00 ` [Bug tree-optimization/113567] " mpolacek at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: zsojka at seznam dot cz @ 2024-01-23 19:50 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113567
           Summary: ICE: SSA corruption: Unable to coalesce ssa_names 1
                    and 3 which are marked as MUST COALESCE. with
                    _BitInt() and computed goto
           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 57196
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57196&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc testcase.c 

Unable to coalesce ssa_names 1 and 3 which are marked as MUST COALESCE.
a_1(ab) and  a_3(ab)
during GIMPLE pass: bitintlower0
testcase.c: In function 'foo':
testcase.c:2:1: internal compiler error: SSA corruption
    2 | foo(_BitInt(953) a)
      | ^~~
0x163e4dd fail_abnormal_edge_coalesce
        /repo/gcc-trunk/gcc/tree-ssa-coalesce.cc:1012
0x163e4dd coalesce_partitions
        /repo/gcc-trunk/gcc/tree-ssa-coalesce.cc:1444
0x163e4dd coalesce_ssa_name(_var_map*)
        /repo/gcc-trunk/gcc/tree-ssa-coalesce.cc:1898
0x271baf3 gimple_lower_bitint
        /repo/gcc-trunk/gcc/gimple-lower-bitint.cc:6319
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-8373-20240123195900-gdbc5f1f523b-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.1/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-8373-20240123195900-gdbc5f1f523b-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.1 20240123 (experimental) (GCC)

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

* [Bug tree-optimization/113567] ICE: SSA corruption: Unable to coalesce ssa_names 1 and 3 which are marked as MUST COALESCE. with _BitInt() and computed goto
  2024-01-23 19:50 [Bug tree-optimization/113567] New: ICE: SSA corruption: Unable to coalesce ssa_names 1 and 3 which are marked as MUST COALESCE. with _BitInt() and computed goto zsojka at seznam dot cz
@ 2024-01-23 20:00 ` mpolacek at gcc dot gnu.org
  2024-01-26  8:14 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-01-23 20:00 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |mpolacek at gcc dot gnu.org
   Last reconfirmed|                            |2024-01-23
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r14-4592:

commit 0d00385eaf72ccacff17935b0d214a26773e095f
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Oct 12 16:01:12 2023 +0200

    wide-int: Allow up to 16320 bits wide_int and change widest_int precision
to 32640 bits [PR102989]

before:

113567.c:2:5: error: ‘_BitInt’ argument ‘953’ is larger than ‘BITINT_MAXWIDTH’
‘575’
    2 | foo(_BitInt(953) a)
      |     ^~~~~~~

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

* [Bug tree-optimization/113567] ICE: SSA corruption: Unable to coalesce ssa_names 1 and 3 which are marked as MUST COALESCE. with _BitInt() and computed goto
  2024-01-23 19:50 [Bug tree-optimization/113567] New: ICE: SSA corruption: Unable to coalesce ssa_names 1 and 3 which are marked as MUST COALESCE. with _BitInt() and computed goto zsojka at seznam dot cz
  2024-01-23 20:00 ` [Bug tree-optimization/113567] " mpolacek at gcc dot gnu.org
@ 2024-01-26  8:14 ` pinskia at gcc dot gnu.org
  2024-01-26  8:20 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-26  8:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #1)
> Started with r14-4592:

Better testcase that does not depend on a very large size:
```
void
foo(_BitInt(128+1) a)
{
lab:
  a %= 3;
  void *p = &&lab;
  goto *p;
}
```

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

* [Bug tree-optimization/113567] ICE: SSA corruption: Unable to coalesce ssa_names 1 and 3 which are marked as MUST COALESCE. with _BitInt() and computed goto
  2024-01-23 19:50 [Bug tree-optimization/113567] New: ICE: SSA corruption: Unable to coalesce ssa_names 1 and 3 which are marked as MUST COALESCE. with _BitInt() and computed goto zsojka at seznam dot cz
  2024-01-23 20:00 ` [Bug tree-optimization/113567] " mpolacek at gcc dot gnu.org
  2024-01-26  8:14 ` pinskia at gcc dot gnu.org
@ 2024-01-26  8:20 ` pinskia at gcc dot gnu.org
  2024-02-14 17:32 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-26  8:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Also here is one which fails even at -O1:
```
_BitInt(128+1) a1;
void foo(_BitInt(128+1) a, int i)
{
   __label__  lab, lab1;
   i &=1;
   void *p[] = {&&lab, &&lab1};
lab:
  a %= 3;
  a1 = a;
  i = !i;
  goto *(p[i]);
lab1:
}
```

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

* [Bug tree-optimization/113567] ICE: SSA corruption: Unable to coalesce ssa_names 1 and 3 which are marked as MUST COALESCE. with _BitInt() and computed goto
  2024-01-23 19:50 [Bug tree-optimization/113567] New: ICE: SSA corruption: Unable to coalesce ssa_names 1 and 3 which are marked as MUST COALESCE. with _BitInt() and computed goto zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2024-01-26  8:20 ` pinskia at gcc dot gnu.org
@ 2024-02-14 17:32 ` jakub at gcc dot gnu.org
  2024-02-15  8:53 ` cvs-commit at gcc dot gnu.org
  2024-02-15  8:54 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-14 17:32 UTC (permalink / raw)
  To: gcc-bugs

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

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 #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 57429
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57429&action=edit
gcc14-pr113567.patch

Untested fix.

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

* [Bug tree-optimization/113567] ICE: SSA corruption: Unable to coalesce ssa_names 1 and 3 which are marked as MUST COALESCE. with _BitInt() and computed goto
  2024-01-23 19:50 [Bug tree-optimization/113567] New: ICE: SSA corruption: Unable to coalesce ssa_names 1 and 3 which are marked as MUST COALESCE. with _BitInt() and computed goto zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2024-02-14 17:32 ` jakub at gcc dot gnu.org
@ 2024-02-15  8:53 ` cvs-commit at gcc dot gnu.org
  2024-02-15  8:54 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-15  8:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 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:baa40971d1600672f3a1abf688905a70cf655c92

commit r14-8995-gbaa40971d1600672f3a1abf688905a70cf655c92
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Feb 15 09:52:47 2024 +0100

    lower-bitint: Ensure we don't get coalescing ICEs for (ab) SSA_NAMEs used
in mul/div/mod [PR113567]

    The build_bitint_stmt_ssa_conflicts hook has a special case for
    multiplication, division and modulo, where to ensure there is no overlap
    between lhs and rhs1/rhs2 arrays we make the lhs conflict with the
    operands.
    On the following testcase, we have
      # a_1(ab) = PHI <a_2(D)(0), a_3(ab)(3)>
    lab:
      a_3(ab) = a_1(ab) % 3;
    before lowering and this special case causes a_3(ab) and a_1(ab) to
    conflict, but the PHI requires them not to conflict, so we ICE because we
    can't find some partitioning that will work.

    The following patch fixes this by special casing such statements before
    the partitioning, force the inputs of the multiplication/division which
    have large/huge _BitInt (ab) lhs into new non-(ab) SSA_NAMEs initialized
    right before the multiplication/division.  This allows the partitioning
    to work then, as it has the possibility to use a different partition for
    the */% operands.

    2024-02-15  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/113567
            * gimple-lower-bitint.cc (gimple_lower_bitint): For large/huge
            _BitInt multiplication, division or modulo with
            SSA_NAME_OCCURS_IN_ABNORMAL_PHI lhs and at least one of rhs1 and
rhs2
            force the affected inputs into a new SSA_NAME.

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

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

* [Bug tree-optimization/113567] ICE: SSA corruption: Unable to coalesce ssa_names 1 and 3 which are marked as MUST COALESCE. with _BitInt() and computed goto
  2024-01-23 19:50 [Bug tree-optimization/113567] New: ICE: SSA corruption: Unable to coalesce ssa_names 1 and 3 which are marked as MUST COALESCE. with _BitInt() and computed goto zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2024-02-15  8:53 ` cvs-commit at gcc dot gnu.org
@ 2024-02-15  8:54 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-15  8:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

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

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

end of thread, other threads:[~2024-02-15  8:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-23 19:50 [Bug tree-optimization/113567] New: ICE: SSA corruption: Unable to coalesce ssa_names 1 and 3 which are marked as MUST COALESCE. with _BitInt() and computed goto zsojka at seznam dot cz
2024-01-23 20:00 ` [Bug tree-optimization/113567] " mpolacek at gcc dot gnu.org
2024-01-26  8:14 ` pinskia at gcc dot gnu.org
2024-01-26  8:20 ` pinskia at gcc dot gnu.org
2024-02-14 17:32 ` jakub at gcc dot gnu.org
2024-02-15  8:53 ` cvs-commit at gcc dot gnu.org
2024-02-15  8:54 ` jakub 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).