public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/113699] New: during GIMPLE pass: bitintlower ICE: SIGSEGV in var_to_partition (tree-ssa-live.h:163) with _BitInt() used in __asm__
@ 2024-02-01  5:19 zsojka at seznam dot cz
  2024-02-01  5:26 ` [Bug middle-end/113699] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: zsojka at seznam dot cz @ 2024-02-01  5:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113699
           Summary: during GIMPLE pass: bitintlower ICE: SIGSEGV in
                    var_to_partition (tree-ssa-live.h:163) with _BitInt()
                    used in __asm__
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          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 57276
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57276&action=edit
reduced testcase (from gcc.target/i386/pr41985.c)

Compiler output:
$ x86_64-pc-linux-gnu-gcc testcase.c -wrapper valgrind,-q
==30321== Invalid read of size 8
==30321==    at 0x271DC7F: var_to_partition (tree-ssa-live.h:163)
==30321==    by 0x271DC7F: lower_asm (gimple-lower-bitint.cc:5203)
==30321==    by 0x271DC7F: (anonymous
namespace)::bitint_large_huge::lower_stmt(gimple*)
(gimple-lower-bitint.cc:5240)
==30321==    by 0x2720009: gimple_lower_bitint() (gimple-lower-bitint.cc:6564)
==30321==    by 0x13CDCBA: execute_one_pass(opt_pass*) (passes.cc:2646)
==30321==    by 0x13CE5AF: execute_pass_list_1(opt_pass*) (passes.cc:2755)
==30321==    by 0x13CE5E8: execute_pass_list(function*, opt_pass*)
(passes.cc:2766)
==30321==    by 0xFCDC05: expand (cgraphunit.cc:1843)
==30321==    by 0xFCDC05: cgraph_node::expand() (cgraphunit.cc:1796)
==30321==    by 0xFCEB19: output_in_order (cgraphunit.cc:2193)
==30321==    by 0xFCEB19: symbol_table::compile() [clone .part.0]
(cgraphunit.cc:2397)
==30321==    by 0xFD1AC7: compile (cgraphunit.cc:2313)
==30321==    by 0xFD1AC7: symbol_table::finalize_compilation_unit()
(cgraphunit.cc:2585)
==30321==    by 0x150FF61: compile_file() (toplev.cc:474)
==30321==    by 0xDE840B: do_compile (toplev.cc:2152)
==30321==    by 0xDE840B: toplev::main(int, char**) (toplev.cc:2308)
==30321==    by 0xDE9BEA: main (main.cc:39)
==30321==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==30321== 
during GIMPLE pass: bitintlower0
testcase.c: In function 'foo':
testcase.c:2:1: internal compiler error: Segmentation fault
    2 | foo (void)
      | ^~~
0x150fa7f crash_signal
        /repo/gcc-trunk/gcc/toplev.cc:317
0x271dc7f var_to_partition(_var_map*, tree_node*)
        /repo/gcc-trunk/gcc/tree-ssa-live.h:163
0x271dc7f lower_asm
        /repo/gcc-trunk/gcc/gimple-lower-bitint.cc:5203
0x271dc7f lower_stmt
        /repo/gcc-trunk/gcc/gimple-lower-bitint.cc:5240
0x2720009 gimple_lower_bitint
        /repo/gcc-trunk/gcc/gimple-lower-bitint.cc:6564
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
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r14-8665-20240131161256-g3fed1609f61-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-8665-20240131161256-g3fed1609f61-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.1 20240131 (experimental) (GCC)

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

* [Bug middle-end/113699] during GIMPLE pass: bitintlower ICE: SIGSEGV in var_to_partition (tree-ssa-live.h:163) with _BitInt() used in __asm__
  2024-02-01  5:19 [Bug tree-optimization/113699] New: during GIMPLE pass: bitintlower ICE: SIGSEGV in var_to_partition (tree-ssa-live.h:163) with _BitInt() used in __asm__ zsojka at seznam dot cz
@ 2024-02-01  5:26 ` pinskia at gcc dot gnu.org
  2024-02-01  5:31 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-01  5:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-02-01
          Component|tree-optimization           |middle-end
           Keywords|                            |ice-on-valid-code
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

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

This happens with an uninitialized variable only.

Here is a valid code testcase:
```
void
foo (void)
{
  _BitInt(129) i;
  __asm__ ("": :"rm" (i));
}
```

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

* [Bug middle-end/113699] during GIMPLE pass: bitintlower ICE: SIGSEGV in var_to_partition (tree-ssa-live.h:163) with _BitInt() used in __asm__
  2024-02-01  5:19 [Bug tree-optimization/113699] New: during GIMPLE pass: bitintlower ICE: SIGSEGV in var_to_partition (tree-ssa-live.h:163) with _BitInt() used in __asm__ zsojka at seznam dot cz
  2024-02-01  5:26 ` [Bug middle-end/113699] " pinskia at gcc dot gnu.org
@ 2024-02-01  5:31 ` pinskia at gcc dot gnu.org
  2024-02-01  9:44 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-01  5:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The code for lowering asm is not expecting an SSA_NAME_IS_DEFAULT_DEF here ...

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

* [Bug middle-end/113699] during GIMPLE pass: bitintlower ICE: SIGSEGV in var_to_partition (tree-ssa-live.h:163) with _BitInt() used in __asm__
  2024-02-01  5:19 [Bug tree-optimization/113699] New: during GIMPLE pass: bitintlower ICE: SIGSEGV in var_to_partition (tree-ssa-live.h:163) with _BitInt() used in __asm__ zsojka at seznam dot cz
  2024-02-01  5:26 ` [Bug middle-end/113699] " pinskia at gcc dot gnu.org
  2024-02-01  5:31 ` pinskia at gcc dot gnu.org
@ 2024-02-01  9:44 ` jakub at gcc dot gnu.org
  2024-02-02 10:30 ` cvs-commit at gcc dot gnu.org
  2024-02-02 10:33 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-01  9:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

Untested fix.

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

* [Bug middle-end/113699] during GIMPLE pass: bitintlower ICE: SIGSEGV in var_to_partition (tree-ssa-live.h:163) with _BitInt() used in __asm__
  2024-02-01  5:19 [Bug tree-optimization/113699] New: during GIMPLE pass: bitintlower ICE: SIGSEGV in var_to_partition (tree-ssa-live.h:163) with _BitInt() used in __asm__ zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2024-02-01  9:44 ` jakub at gcc dot gnu.org
@ 2024-02-02 10:30 ` cvs-commit at gcc dot gnu.org
  2024-02-02 10:33 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-02 10:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 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:49e75666c592d23dfa17f062974e660edd01d5fb

commit r14-8746-g49e75666c592d23dfa17f062974e660edd01d5fb
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Feb 2 11:27:37 2024 +0100

    lower-bitint: Handle uninitialized large/huge SSA_NAMEs as inline asm
inputs [PR113699]

    Similar problem to calls with uninitialized large/huge _BitInt SSA_NAME
    arguments, var_to_partition will not work for those, but unlike calls
    where we just create a new uninitialized SSA_NAME here we need to change
    the inline asm input to be an uninitialized VAR_DECL.

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

            PR middle-end/113699
            * gimple-lower-bitint.cc (bitint_large_huge::lower_asm): Handle
            uninitialized large/huge _BitInt SSA_NAME inputs.

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

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

* [Bug middle-end/113699] during GIMPLE pass: bitintlower ICE: SIGSEGV in var_to_partition (tree-ssa-live.h:163) with _BitInt() used in __asm__
  2024-02-01  5:19 [Bug tree-optimization/113699] New: during GIMPLE pass: bitintlower ICE: SIGSEGV in var_to_partition (tree-ssa-live.h:163) with _BitInt() used in __asm__ zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2024-02-02 10:30 ` cvs-commit at gcc dot gnu.org
@ 2024-02-02 10:33 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-02-02 10:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

end of thread, other threads:[~2024-02-02 10:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-01  5:19 [Bug tree-optimization/113699] New: during GIMPLE pass: bitintlower ICE: SIGSEGV in var_to_partition (tree-ssa-live.h:163) with _BitInt() used in __asm__ zsojka at seznam dot cz
2024-02-01  5:26 ` [Bug middle-end/113699] " pinskia at gcc dot gnu.org
2024-02-01  5:31 ` pinskia at gcc dot gnu.org
2024-02-01  9:44 ` jakub at gcc dot gnu.org
2024-02-02 10:30 ` cvs-commit at gcc dot gnu.org
2024-02-02 10:33 ` 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).