public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/114313] New: ICE: in limb_access_type, at gimple-lower-bitint.cc:591 with _BitInt() in a bitfield
@ 2024-03-11 19:04 zsojka at seznam dot cz
  2024-03-11 20:48 ` [Bug middle-end/114313] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zsojka at seznam dot cz @ 2024-03-11 19:04 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114313
           Summary: ICE: in limb_access_type, at
                    gimple-lower-bitint.cc:591 with _BitInt() in a
                    bitfield
           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 57674
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57674&action=edit
reduced testcase

Compiler output:
$ x86_64-pc-linux-gnu-gcc testcase.c
during GIMPLE pass: bitintlower0
testcase.c: In function 'foo':
testcase.c:8:1: internal compiler error: in limb_access_type, at
gimple-lower-bitint.cc:591
    8 | foo (void)
      | ^~~
0xd748bf limb_access_type
        /repo/gcc-trunk/gcc/gimple-lower-bitint.cc:591
0x264c8d4 limb_access_type
        /repo/gcc-trunk/gcc/gimple-lower-bitint.cc:587
0x264c8d4 limb_access
        /repo/gcc-trunk/gcc/gimple-lower-bitint.cc:606
0x265c659 handle_load
        /repo/gcc-trunk/gcc/gimple-lower-bitint.cc:1857
0x265c659 handle_stmt
        /repo/gcc-trunk/gcc/gimple-lower-bitint.cc:2066
0x265e1f4 lower_mergeable_stmt
        /repo/gcc-trunk/gcc/gimple-lower-bitint.cc:2610
0x26625dc lower_stmt
        /repo/gcc-trunk/gcc/gimple-lower-bitint.cc:5560
0x2665699 gimple_lower_bitint
        /repo/gcc-trunk/gcc/gimple-lower-bitint.cc:6860
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-9425-20240311112226-g119f5ae0455-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 --enable-libsanitizer
--disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r14-9425-20240311112226-g119f5ae0455-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.1 20240311 (experimental) (GCC)

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

* [Bug middle-end/114313] ICE: in limb_access_type, at gimple-lower-bitint.cc:591 with _BitInt() in a bitfield
  2024-03-11 19:04 [Bug tree-optimization/114313] New: ICE: in limb_access_type, at gimple-lower-bitint.cc:591 with _BitInt() in a bitfield zsojka at seznam dot cz
@ 2024-03-11 20:48 ` pinskia at gcc dot gnu.org
  2024-03-12 15:55 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-11 20:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-03-11
          Component|tree-optimization           |middle-end
     Ever confirmed|0                           |1

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

Easier testcase:
```
#define size 129
struct
{
  _BitInt(size) a : size;
  _BitInt(size) b : size;
} bf;

int
foo (void)
{
  return bf.b;
}
```

Note changing the bitfield size down to below 128 allows the above not to ICE.

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

* [Bug middle-end/114313] ICE: in limb_access_type, at gimple-lower-bitint.cc:591 with _BitInt() in a bitfield
  2024-03-11 19:04 [Bug tree-optimization/114313] New: ICE: in limb_access_type, at gimple-lower-bitint.cc:591 with _BitInt() in a bitfield zsojka at seznam dot cz
  2024-03-11 20:48 ` [Bug middle-end/114313] " pinskia at gcc dot gnu.org
@ 2024-03-12 15:55 ` jakub at gcc dot gnu.org
  2024-03-13  9:20 ` cvs-commit at gcc dot gnu.org
  2024-03-13  9:24 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-03-12 15:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

Untested fix.

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

* [Bug middle-end/114313] ICE: in limb_access_type, at gimple-lower-bitint.cc:591 with _BitInt() in a bitfield
  2024-03-11 19:04 [Bug tree-optimization/114313] New: ICE: in limb_access_type, at gimple-lower-bitint.cc:591 with _BitInt() in a bitfield zsojka at seznam dot cz
  2024-03-11 20:48 ` [Bug middle-end/114313] " pinskia at gcc dot gnu.org
  2024-03-12 15:55 ` jakub at gcc dot gnu.org
@ 2024-03-13  9:20 ` cvs-commit at gcc dot gnu.org
  2024-03-13  9:24 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-13  9:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:0613b12dd7f6274a1aac07f295ed51d86c2c85f1

commit r14-9447-g0613b12dd7f6274a1aac07f295ed51d86c2c85f1
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Mar 13 10:19:04 2024 +0100

    bitint: Fix up lowering of bitfield loads/stores [PR114313]

    The following testcase ICEs, because for large/huge _BitInt bitfield
    loads/stores we use the DECL_BIT_FIELD_REPRESENTATIVE as the underlying
    "var" and indexes into it can be larger than the precision of the
    bitfield might normally allow.

    The following patch fixes that by passing NULL_TREE type in that case
    to limb_access, so that we always return m_limb_type type and don't
    do the extra assertions, after all, the callers expect that too.
    I had to add the first hunk to avoid ICE, it was using type in one place
    even when it was NULL.  But TYPE_SIZE (TREE_TYPE (var)) seems like the
    right size to use anyway because the code uses VIEW_CONVERT_EXPR on it.

    2024-03-13  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/114313
            * gimple-lower-bitint.cc (bitint_large_huge::limb_access): Use
            TYPE_SIZE of TREE_TYPE (var) rather than TYPE_SIZE of type.
            (bitint_large_huge::handle_load): Pass NULL_TREE rather than
            rhs_type to limb_access for the bitfield load cases.
            (bitint_large_huge::lower_mergeable_stmt): Pass NULL_TREE rather
than
            lhs_type to limb_access if nlhs is non-NULL.

            * gcc.dg/torture/bitint-62.c: New test.

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

* [Bug middle-end/114313] ICE: in limb_access_type, at gimple-lower-bitint.cc:591 with _BitInt() in a bitfield
  2024-03-11 19:04 [Bug tree-optimization/114313] New: ICE: in limb_access_type, at gimple-lower-bitint.cc:591 with _BitInt() in a bitfield zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2024-03-13  9:20 ` cvs-commit at gcc dot gnu.org
@ 2024-03-13  9:24 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-03-13  9:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

end of thread, other threads:[~2024-03-13  9:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-11 19:04 [Bug tree-optimization/114313] New: ICE: in limb_access_type, at gimple-lower-bitint.cc:591 with _BitInt() in a bitfield zsojka at seznam dot cz
2024-03-11 20:48 ` [Bug middle-end/114313] " pinskia at gcc dot gnu.org
2024-03-12 15:55 ` jakub at gcc dot gnu.org
2024-03-13  9:20 ` cvs-commit at gcc dot gnu.org
2024-03-13  9:24 ` 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).