public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/112778] New: [14 Regression] ICE in ppc64-linux-gnu crosscompiler in store_by_pieces, at expr.cc:1820
@ 2023-11-30 10:53 fkastl at suse dot cz
  2023-12-01  6:46 ` [Bug target/112778] ICE in ppc64-linux-gnu crosscompiler in store_by_pieces since r14-5946-g1ff6d9f7428b06 linkw at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: fkastl at suse dot cz @ 2023-11-30 10:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112778
           Summary: [14 Regression] ICE in ppc64-linux-gnu crosscompiler
                    in store_by_pieces, at expr.cc:1820
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fkastl at suse dot cz
  Target Milestone: ---
              Host: x86_64-linux
            Target: ppc64-linux-gnu

Compiling the gcc.dg/strlenopt-5.c GCC testsuite testcase with ppc64-linux-gnu
as target like this:

ppc64-linux-gnu-gcc
/home/worker/buildworker/tiber-option-juggler/build/gcc/testsuite/gcc.dg/strlenopt-5.c
-finline-stringops

results in and ICE:

during RTL pass: expand
../src/gcc/testsuite/gcc.dg/strlenopt-5.c: In function ‘main’:
../src/gcc/testsuite/gcc.dg/strlenopt-5.c:35:3: internal compiler error: in
store_by_pieces, at expr.cc:1820
   35 |   memset (buf, 'v', 3);
      |   ^~~~~~~~~~~~~~~~~~~~
0x644072 store_by_pieces(rtx_def*, unsigned long, rtx_def* (*)(void*, void*,
long, fixed_size_mode), void*, unsigned int, bool, memop_ret)
        /home/worker/buildworker/tiber-gcc-trunk-ppc64/build/gcc/expr.cc:1820
0x7a1197 try_store_by_multiple_pieces(rtx_def*, rtx_def*, unsigned int,
unsigned long, unsigned long, rtx_def*, char, unsigned int)
       
/home/worker/buildworker/tiber-gcc-trunk-ppc64/build/gcc/builtins.cc:4456
0x7a7f63 expand_builtin_memset_args
       
/home/worker/buildworker/tiber-gcc-trunk-ppc64/build/gcc/builtins.cc:4661
0x7aa174 expand_builtin_memset(tree_node*, rtx_def*, machine_mode)
       
/home/worker/buildworker/tiber-gcc-trunk-ppc64/build/gcc/builtins.cc:4279
0x7aa174 expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int)
       
/home/worker/buildworker/tiber-gcc-trunk-ppc64/build/gcc/builtins.cc:7834
0x8cbd08 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        /home/worker/buildworker/tiber-gcc-trunk-ppc64/build/gcc/expr.cc:12304
0x7c8366 expand_expr(tree_node*, rtx_def*, machine_mode, expand_modifier)
        /home/worker/buildworker/tiber-gcc-trunk-ppc64/build/gcc/expr.h:313
0x7c8366 expand_call_stmt
       
/home/worker/buildworker/tiber-gcc-trunk-ppc64/build/gcc/cfgexpand.cc:2832
0x7c8366 expand_gimple_stmt_1
       
/home/worker/buildworker/tiber-gcc-trunk-ppc64/build/gcc/cfgexpand.cc:3881
0x7c8366 expand_gimple_stmt
       
/home/worker/buildworker/tiber-gcc-trunk-ppc64/build/gcc/cfgexpand.cc:4045
0x7ccd07 expand_gimple_basic_block
       
/home/worker/buildworker/tiber-gcc-trunk-ppc64/build/gcc/cfgexpand.cc:6101
0x7ce9fe execute
       
/home/worker/buildworker/tiber-gcc-trunk-ppc64/build/gcc/cfgexpand.cc:6836
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.


The same error (even the same stacktrace) also occurs with

ppc64-linux-gnu-gfortran
/home/worker/llvm/src/flang/test/Lower/HLFIR/function-return.f90
-finline-stringops

ppc64-linux-gnu-gfortran
/home/worker/buildworker/tiber-option-juggler/build/gcc/testsuite/gfortran.dg/implied_do_io_4.f90
-Os -finline-stringops

ppc64-linux-gnu-gfortran
/home/worker/buildworker/tiber-option-juggler/build/gcc/testsuite/gfortran.dg/gomp/defaultmap-5.f90
-finline-stringops

ppc64-linux-gnu-gfortran
/home/worker/buildworker/tiber-option-juggler/build/gcc/testsuite/gfortran.dg/verify_2.f90
-finline-stringops


Compiler configuration:

Using built-in specs.
COLLECT_GCC=/home/worker/cross/bin/ppc64-linux-gnu-gfortran
COLLECT_LTO_WRAPPER=/home/worker/cross/libexec/gcc/ppc64-linux-gnu/14.0.0/lto-wrapper
Target: ppc64-linux-gnu
Configured with: /home/worker/buildworker/tiber-gcc-trunk-ppc64/build/configure
--enable-languages=c,c++,fortran,rust,m2 --disable-bootstrap
--disable-libsanitizer --disable-multilib --enable-checking=release
--prefix=/home/worker/cross --target=ppc64-linux-gnu
--with-as=/usr/bin/powerpc64-suse-linux-as
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 14.0.0 20231130 (experimental)
31d8cf17ca4537e35bc7507ff1d9dfce077c0c68 (GCC)

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

* [Bug target/112778] ICE in ppc64-linux-gnu crosscompiler in store_by_pieces since r14-5946-g1ff6d9f7428b06
  2023-11-30 10:53 [Bug target/112778] New: [14 Regression] ICE in ppc64-linux-gnu crosscompiler in store_by_pieces, at expr.cc:1820 fkastl at suse dot cz
@ 2023-12-01  6:46 ` linkw at gcc dot gnu.org
  2023-12-09  3:00 ` aoliva at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: linkw at gcc dot gnu.org @ 2023-12-01  6:46 UTC (permalink / raw)
  To: gcc-bugs

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

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aoliva at gcc dot gnu.org,
                   |                            |bergner at gcc dot gnu.org,
                   |                            |linkw at gcc dot gnu.org,
                   |                            |segher at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
            Summary|ICE in ppc64-linux-gnu      |ICE in ppc64-linux-gnu
                   |crosscompiler in            |crosscompiler in
                   |store_by_pieces, at         |store_by_pieces since
                   |expr.cc:1820                |r14-5946-g1ff6d9f7428b06
           Keywords|needs-bisection             |
   Last reconfirmed|                            |2023-12-01

--- Comment #1 from Kewen Lin <linkw at gcc dot gnu.org> ---
Confirmed, thanks for reporting, it starts from r14-5946-g1ff6d9f7428b06.

It looks function try_store_by_multiple_pieces has the wrong assumption. For
the code "memset (buf, 'v', 3)", it checks 

+          if (max_bits < orig_max_bits
+              && xlenest + blksize >= xlenest
+              && can_store_by_pieces (xlenest + blksize,
+                                      builtin_memset_read_str,
+                                      &valc, align, true))

, succeeds and breaks. later it goes with blksize:

      to = store_by_pieces (to, blksize,
                            constfun, constfundata,
                            align, true,
                            max_len != 0 ? RETURN_END : RETURN_BEGIN);

and fails at targetm.use_by_pieces_infrastructure_p assertion.

It's concluded that can_store_by_pieces (xlenest + blksize, ...) doesn't
necessarily means can_store_by_pieces (blksize, ...).

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

* [Bug target/112778] ICE in ppc64-linux-gnu crosscompiler in store_by_pieces since r14-5946-g1ff6d9f7428b06
  2023-11-30 10:53 [Bug target/112778] New: [14 Regression] ICE in ppc64-linux-gnu crosscompiler in store_by_pieces, at expr.cc:1820 fkastl at suse dot cz
  2023-12-01  6:46 ` [Bug target/112778] ICE in ppc64-linux-gnu crosscompiler in store_by_pieces since r14-5946-g1ff6d9f7428b06 linkw at gcc dot gnu.org
@ 2023-12-09  3:00 ` aoliva at gcc dot gnu.org
  2023-12-11 18:32 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: aoliva at gcc dot gnu.org @ 2023-12-09  3:00 UTC (permalink / raw)
  To: gcc-bugs

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

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

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

--- Comment #2 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Mine.

Patch at https://gcc.gnu.org/pipermail/gcc-patches/2023-December/639987.html

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

* [Bug target/112778] ICE in ppc64-linux-gnu crosscompiler in store_by_pieces since r14-5946-g1ff6d9f7428b06
  2023-11-30 10:53 [Bug target/112778] New: [14 Regression] ICE in ppc64-linux-gnu crosscompiler in store_by_pieces, at expr.cc:1820 fkastl at suse dot cz
  2023-12-01  6:46 ` [Bug target/112778] ICE in ppc64-linux-gnu crosscompiler in store_by_pieces since r14-5946-g1ff6d9f7428b06 linkw at gcc dot gnu.org
  2023-12-09  3:00 ` aoliva at gcc dot gnu.org
@ 2023-12-11 18:32 ` cvs-commit at gcc dot gnu.org
  2023-12-11 18:47 ` aoliva at gcc dot gnu.org
  2023-12-21  6:21 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-11 18:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alexandre Oliva <aoliva@gcc.gnu.org>:

https://gcc.gnu.org/g:1e2ea685bdea9aa65da2bf4137264d14f38a6f0b

commit r14-6430-g1e2ea685bdea9aa65da2bf4137264d14f38a6f0b
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Mon Dec 11 15:09:25 2023 -0300

    -finline-stringops: check base blksize for memset [PR112778]

    The recently-added logic for -finline-stringops=memset introduced an
    assumption that doesn't necessarily hold, namely, that
    can_store_by_pieces of a larger size implies can_store_by_pieces by
    smaller sizes.  Checks for all sizes the by-multiple-pieces machinery
    might use before committing to an expansion pattern.


    for  gcc/ChangeLog

            PR target/112778
            * builtins.cc (can_store_by_multiple_pieces): New.
            (try_store_by_multiple_pieces): Call it.

    for  gcc/testsuite/ChangeLog

            PR target/112778
            * gcc.dg/inline-mem-cmp-pr112778.c: New.

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

* [Bug target/112778] ICE in ppc64-linux-gnu crosscompiler in store_by_pieces since r14-5946-g1ff6d9f7428b06
  2023-11-30 10:53 [Bug target/112778] New: [14 Regression] ICE in ppc64-linux-gnu crosscompiler in store_by_pieces, at expr.cc:1820 fkastl at suse dot cz
                   ` (2 preceding siblings ...)
  2023-12-11 18:32 ` cvs-commit at gcc dot gnu.org
@ 2023-12-11 18:47 ` aoliva at gcc dot gnu.org
  2023-12-21  6:21 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: aoliva at gcc dot gnu.org @ 2023-12-11 18:47 UTC (permalink / raw)
  To: gcc-bugs

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

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

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

--- Comment #4 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Fixed

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

* [Bug target/112778] ICE in ppc64-linux-gnu crosscompiler in store_by_pieces since r14-5946-g1ff6d9f7428b06
  2023-11-30 10:53 [Bug target/112778] New: [14 Regression] ICE in ppc64-linux-gnu crosscompiler in store_by_pieces, at expr.cc:1820 fkastl at suse dot cz
                   ` (3 preceding siblings ...)
  2023-12-11 18:47 ` aoliva at gcc dot gnu.org
@ 2023-12-21  6:21 ` cvs-commit at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-21  6:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alexandre Oliva <aoliva@gcc.gnu.org>:

https://gcc.gnu.org/g:514ea1df444ca7f64c3f504ced05d8fb5fbfd62d

commit r14-6769-g514ea1df444ca7f64c3f504ced05d8fb5fbfd62d
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Thu Dec 21 03:21:23 2023 -0300

    -finline-stringops: drop obsolete comment [PR112778]

    When fixing the PR, I failed to remove the comment that raised the
    very concern that the PR confirmed, and that the earlier patch for the
    PR fixed.


    for  gcc/ChangeLog

            PR target/112778
            * builtins.cc (try_store_by_multiple_pieces): Drop obsolete
            comment.

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

end of thread, other threads:[~2023-12-21  6:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-30 10:53 [Bug target/112778] New: [14 Regression] ICE in ppc64-linux-gnu crosscompiler in store_by_pieces, at expr.cc:1820 fkastl at suse dot cz
2023-12-01  6:46 ` [Bug target/112778] ICE in ppc64-linux-gnu crosscompiler in store_by_pieces since r14-5946-g1ff6d9f7428b06 linkw at gcc dot gnu.org
2023-12-09  3:00 ` aoliva at gcc dot gnu.org
2023-12-11 18:32 ` cvs-commit at gcc dot gnu.org
2023-12-11 18:47 ` aoliva at gcc dot gnu.org
2023-12-21  6:21 ` cvs-commit 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).