public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/102222] New: ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770)
@ 2021-09-06 19:19 sam at gentoo dot org
  2021-09-06 19:21 ` [Bug c/102222] " sam at gentoo dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: sam at gentoo dot org @ 2021-09-06 19:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102222
           Summary: ICE on s390 (internal compiler error: in extract_insn,
                    at recog.c:2770)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sam at gentoo dot org
  Target Milestone: ---

Originally reported downstream at https://bugs.gentoo.org/811867.

This is my first time filing an ICE bug so let me know if I've messed something
up.

The issue was originally observed on a native s390 machine (s390-ibm-linux-gnu)
but I ended up minimising the ICE using cvise via cross. I hit the issue when
building squashfs-tools-4.5. It does not occur with -march=native.

I've managed to minimise the crasher to:
```
$ cat unsquash-1.i
struct squashfs_reg_inode_header_1 read_inode_inode;
read_inode_val;
struct squashfs_reg_inode_header_1 {
  int file_size : 32
} __attribute__((packed)) read_inode() {
  read_inode_inode.file_size = read_inode_val;
}
```

It can be induced via:
```
$ s390-ibm-linux-gnu-gcc -O2 -pipe -march=z10 unsquash-1.i
unsquash-1.i:2:1: warning: data definition has no type or storage class
    2 | read_inode_val;
      | ^~~~~~~~~~~~~~
unsquash-1.i:2:1: warning: type defaults to ‘int’ in declaration of
‘read_inode_val’ [-Wimplicit-int]
unsquash-1.i:5:1: warning: no semicolon at end of struct or union
    5 | } __attribute__((packed)) read_inode() {
      | ^
unsquash-1.i: In function ‘read_inode’:
unsquash-1.i:7:1: error: unrecognizable insn:
    7 | }
      | ^
(insn 9 8 10 2 (set (strict_low_part (reg:SI 66))
        (mem/c:SI (plus:SI (reg/f:SI 64)
                (const_int 4 [0x4])) [1 read_inode_val+0 S4 A32]))
"unsquash-1.i":6:30 -1
     (nil))
during RTL pass: vregs
unsquash-1.i:7:1: internal compiler error: in extract_insn, at recog.c:2770
0x7fa3a9bb680c __libc_start_main
        ../csu/libc-start.c:332
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
```

```
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/s390-ibm-linux-gnu/11.2.0/lto-wrapper
Target: s390-ibm-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-11.2.0/work/gcc-11.2.0/configure
--host=s390-ibm-linux-gnu --build=s390-ibm-linux-gnu --prefix=/usr
--bindir=/usr/s390-ibm-linux-gnu/gcc-bin/11.2.0
--includedir=/usr/lib/gcc/s390-ibm-linux-gnu/11.2.0/include
--datadir=/usr/share/gcc-data/s390-ibm-linux-gnu/11.2.0
--mandir=/usr/share/gcc-data/s390-ibm-linux-gnu/11.2.0/man
--infodir=/usr/share/gcc-data/s390-ibm-linux-gnu/11.2.0/info
--with-gxx-include-dir=/usr/lib/gcc/s390-ibm-linux-gnu/11.2.0/include/g++-v11
--with-python-dir=/share/gcc-data/s390-ibm-linux-gnu/11.2.0/python
--enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls --without-included-gettext
--disable-libunwind-exceptions --enable-checking=release
--with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 11.2.0 p1'
--disable-esp --enable-libstdcxx-time --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --disable-multilib
--disable-fixed-point --enable-libgomp --disable-libssp --disable-libada
--disable-systemtap --disable-valgrind-annotations --disable-vtable-verify
--disable-libvtv --without-zstd --enable-lto --without-isl
--disable-libsanitizer --disable-default-pie --enable-default-ssp
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.2.0 (Gentoo 11.2.0 p1)
```

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

* [Bug c/102222] ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770)
  2021-09-06 19:19 [Bug c/102222] New: ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770) sam at gentoo dot org
@ 2021-09-06 19:21 ` sam at gentoo dot org
  2021-09-06 19:56 ` sam at gentoo dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: sam at gentoo dot org @ 2021-09-06 19:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Sam James <sam at gentoo dot org> ---
Created attachment 51418
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51418&action=edit
build.log from compiling squashfs-tools-4.5

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

* [Bug c/102222] ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770)
  2021-09-06 19:19 [Bug c/102222] New: ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770) sam at gentoo dot org
  2021-09-06 19:21 ` [Bug c/102222] " sam at gentoo dot org
@ 2021-09-06 19:56 ` sam at gentoo dot org
  2021-09-06 21:42 ` [Bug target/102222] " sam at gentoo dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: sam at gentoo dot org @ 2021-09-06 19:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Sam James <sam at gentoo dot org> ---
(In reply to Sam James from comment #0)
> The issue was originally observed on a native s390 machine
> (s390-ibm-linux-gnu) but I ended up minimising the ICE using cvise via
> cross. I hit the issue when building squashfs-tools-4.5. It does not occur
> with -march=native.
> 

There aren't that many differences between -march=z10 and -march=native
seemingly, but it appears -mzarch triggers it.

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

* [Bug target/102222] ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770)
  2021-09-06 19:19 [Bug c/102222] New: ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770) sam at gentoo dot org
  2021-09-06 19:21 ` [Bug c/102222] " sam at gentoo dot org
  2021-09-06 19:56 ` sam at gentoo dot org
@ 2021-09-06 21:42 ` sam at gentoo dot org
  2021-09-07  9:24 ` marxin at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: sam at gentoo dot org @ 2021-09-06 21:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Sam James <sam at gentoo dot org> ---
This appears to work fine (cannot reproduce the ICE) with GCC 12 at
1bc66017c118229a101f0a2c097a9c209f777883:

```
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/s390-ibm-linux-gnu/12.0.0/lto-wrapper
Target: s390-ibm-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-12.0.0_pre9999/work/gcc-12.0.0_pre9999/configure
--host=s390-ibm-linux-gnu --build=s390-ibm-linux-gnu --prefix=/usr
--bindir=/usr/s390-ibm-linux-gnu/gcc-bin/12.0.0
--includedir=/usr/lib/gcc/s390-ibm-linux-gnu/12.0.0/include
--datadir=/usr/share/gcc-data/s390-ibm-linux-gnu/12.0.0
--mandir=/usr/share/gcc-data/s390-ibm-linux-gnu/12.0.0/man
--infodir=/usr/share/gcc-data/s390-ibm-linux-gnu/12.0.0/info
--with-gxx-include-dir=/usr/lib/gcc/s390-ibm-linux-gnu/12.0.0/include/g++-v12
--with-python-dir=/share/gcc-data/s390-ibm-linux-gnu/12.0.0/python
--enable-languages=c,c++,fortran --enable-obsolete --enable-secureplt
--disable-werror --with-system-zlib --enable-nls --without-included-gettext
--disable-libunwind-exceptions --enable-checking=release
--with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 12.0.0_pre9999
p2, commit 1bc66017c118229a101f0a2c097a9c209f777883' --disable-esp
--enable-libstdcxx-time --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --disable-multilib
--disable-fixed-point --enable-libgomp --disable-libssp --disable-libada
--disable-systemtap --disable-valgrind-annotations --disable-vtable-verify
--disable-libvtv --without-zstd --enable-lto --without-isl
--disable-libsanitizer --disable-default-pie --enable-default-ssp
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210906 (experimental) (Gentoo 12.0.0_pre9999 p2, commit
1bc66017c118229a101f0a2c097a9c209f777883)
```

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

* [Bug target/102222] ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770)
  2021-09-06 19:19 [Bug c/102222] New: ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770) sam at gentoo dot org
                   ` (2 preceding siblings ...)
  2021-09-06 21:42 ` [Bug target/102222] " sam at gentoo dot org
@ 2021-09-07  9:24 ` marxin at gcc dot gnu.org
  2021-09-14 19:55 ` krebbel at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-09-07  9:24 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-09-07
                 CC|                            |krebbel at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Thank you for the report.
I can confirm it happens for the current master:

$ ./xgcc -B. ~/Programming/testcases/pr102222.c -O2 -pipe -march=z10 -c
./as: line 114: exec: -m: invalid option
exec: usage: exec [-cl] [-a name] [command [argument ...]] [redirection ...]
/home/marxin/Programming/testcases/pr102222.c:2:1: warning: data definition has
no type or storage class
    2 | read_inode_val;
      | ^~~~~~~~~~~~~~
/home/marxin/Programming/testcases/pr102222.c:2:1: warning: type defaults to
‘int’ in declaration of ‘read_inode_val’ [-Wimplicit-int]
/home/marxin/Programming/testcases/pr102222.c:5:1: warning: no semicolon at end
of struct or union
    5 | } __attribute__((packed)) read_inode() {
      | ^
/home/marxin/Programming/testcases/pr102222.c: In function ‘read_inode’:
/home/marxin/Programming/testcases/pr102222.c:7:1: error: unrecognizable insn:
    7 | }
      | ^
(insn 9 8 10 2 (set (strict_low_part (reg:SI 66))
        (mem/c:SI (plus:SI (reg/f:SI 64)
                (const_int 4 [0x4])) [1 read_inode_val+0 S4 A32]))
"/home/marxin/Programming/testcases/pr102222.c":6:30 -1
     (nil))
during RTL pass: vregs
/home/marxin/Programming/testcases/pr102222.c:7:1: internal compiler error: in
extract_insn, at recog.c:2769
0x6998f5 _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        /home/marxin/Programming/gcc2/gcc/rtl-error.c:108
0x699911 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        /home/marxin/Programming/gcc2/gcc/rtl-error.c:116
0x698327 extract_insn(rtx_insn*)
        /home/marxin/Programming/gcc2/gcc/recog.c:2769
0xaa8bb5 instantiate_virtual_regs_in_insn
        /home/marxin/Programming/gcc2/gcc/function.c:1611
0xaa8bb5 instantiate_virtual_regs
        /home/marxin/Programming/gcc2/gcc/function.c:1985
0xaa8bb5 execute
        /home/marxin/Programming/gcc2/gcc/function.c:2034
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ ./xgcc -v
Using built-in specs.
COLLECT_GCC=./xgcc
Target: s390-linux-gnu
Configured with: /home/marxin/Programming/gcc2/configure
--enable-languages=c,c++,fortran,lto --prefix=/home/marxin/bin/gcc2
--disable-bootstrap --disable-multilib --disable-libsanitizer
--target=s390-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20210907 (experimental) (GCC)

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

* [Bug target/102222] ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770)
  2021-09-06 19:19 [Bug c/102222] New: ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770) sam at gentoo dot org
                   ` (3 preceding siblings ...)
  2021-09-07  9:24 ` marxin at gcc dot gnu.org
@ 2021-09-14 19:55 ` krebbel at gcc dot gnu.org
  2021-09-14 19:57 ` krebbel at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: krebbel at gcc dot gnu.org @ 2021-09-14 19:55 UTC (permalink / raw)
  To: gcc-bugs

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

Andreas Krebbel <krebbel at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |krebbel at gcc dot gnu.org

--- Comment #5 from Andreas Krebbel <krebbel at gcc dot gnu.org> ---
Created attachment 51461
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51461&action=edit
Experimental patch

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

* [Bug target/102222] ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770)
  2021-09-06 19:19 [Bug c/102222] New: ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770) sam at gentoo dot org
                   ` (4 preceding siblings ...)
  2021-09-14 19:55 ` krebbel at gcc dot gnu.org
@ 2021-09-14 19:57 ` krebbel at gcc dot gnu.org
  2021-09-22  7:42 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: krebbel at gcc dot gnu.org @ 2021-09-14 19:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andreas Krebbel <krebbel at gcc dot gnu.org> ---
(insn 9 8 10 2 (set (strict_low_part (reg:SI 66))
        (mem/c:SI (plus:SI (reg/f:SI 64)
                (const_int 4 [0x4])) [1 read_inode_val+0 S4 A32]))

With -mesa this should be a simple move. However, in that case it apparently is
emitted via insv.

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

* [Bug target/102222] ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770)
  2021-09-06 19:19 [Bug c/102222] New: ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770) sam at gentoo dot org
                   ` (5 preceding siblings ...)
  2021-09-14 19:57 ` krebbel at gcc dot gnu.org
@ 2021-09-22  7:42 ` cvs-commit at gcc dot gnu.org
  2021-09-22 10:21 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-22  7:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Andreas Krebbel <krebbel@gcc.gnu.org>:

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

commit r12-3780-ga9b3c451be58f0fe660154323ace7ba72a4211ec
Author: Andreas Krebbel <krebbel@linux.ibm.com>
Date:   Wed Sep 22 09:32:21 2021 +0200

    IBM Z: Fix PR102222

    Avoid emitting a strict low part move if the insv target actually
    affects the whole target reg.

    gcc/ChangeLog:

            PR target/102222
            * config/s390/s390.c (s390_expand_insv): Emit a normal move if it
            is actually a full copy of the source operand into the target.
            Don't emit a strict low part move if source and target mode match.

    gcc/testsuite/ChangeLog:

            * gcc.target/s390/pr102222.c: New test.

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

* [Bug target/102222] ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770)
  2021-09-06 19:19 [Bug c/102222] New: ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770) sam at gentoo dot org
                   ` (6 preceding siblings ...)
  2021-09-22  7:42 ` cvs-commit at gcc dot gnu.org
@ 2021-09-22 10:21 ` cvs-commit at gcc dot gnu.org
  2021-10-15  3:10 ` sam at gentoo dot org
  2022-12-22 14:51 ` mpolacek at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-22 10:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Andreas Krebbel
<krebbel@gcc.gnu.org>:

https://gcc.gnu.org/g:22b25535b8b2f9961e4772b1cc7cce5dc2f60719

commit r11-9025-g22b25535b8b2f9961e4772b1cc7cce5dc2f60719
Author: Andreas Krebbel <krebbel@linux.ibm.com>
Date:   Wed Sep 22 09:32:21 2021 +0200

    IBM Z: Fix PR102222

    Avoid emitting a strict low part move if the insv target actually
    affects the whole target reg.

    gcc/ChangeLog:

            PR target/102222
            * config/s390/s390.c (s390_expand_insv): Emit a normal move if it
            is actually a full copy of the source operand into the target.
            Don't emit a strict low part move if source and target mode match.

    gcc/testsuite/ChangeLog:

            * gcc.target/s390/pr102222.c: New test.

    (cherry picked from commit a9b3c451be58f0fe660154323ace7ba72a4211ec)

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

* [Bug target/102222] ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770)
  2021-09-06 19:19 [Bug c/102222] New: ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770) sam at gentoo dot org
                   ` (7 preceding siblings ...)
  2021-09-22 10:21 ` cvs-commit at gcc dot gnu.org
@ 2021-10-15  3:10 ` sam at gentoo dot org
  2022-12-22 14:51 ` mpolacek at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: sam at gentoo dot org @ 2021-10-15  3:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Sam James <sam at gentoo dot org> ---
Confirmed that the GCC 11 branch backport works here. Thanks all!

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

* [Bug target/102222] ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770)
  2021-09-06 19:19 [Bug c/102222] New: ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770) sam at gentoo dot org
                   ` (8 preceding siblings ...)
  2021-10-15  3:10 ` sam at gentoo dot org
@ 2022-12-22 14:51 ` mpolacek at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-12-22 14:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #10 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Looks fixed.

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

end of thread, other threads:[~2022-12-22 14:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-06 19:19 [Bug c/102222] New: ICE on s390 (internal compiler error: in extract_insn, at recog.c:2770) sam at gentoo dot org
2021-09-06 19:21 ` [Bug c/102222] " sam at gentoo dot org
2021-09-06 19:56 ` sam at gentoo dot org
2021-09-06 21:42 ` [Bug target/102222] " sam at gentoo dot org
2021-09-07  9:24 ` marxin at gcc dot gnu.org
2021-09-14 19:55 ` krebbel at gcc dot gnu.org
2021-09-14 19:57 ` krebbel at gcc dot gnu.org
2021-09-22  7:42 ` cvs-commit at gcc dot gnu.org
2021-09-22 10:21 ` cvs-commit at gcc dot gnu.org
2021-10-15  3:10 ` sam at gentoo dot org
2022-12-22 14:51 ` mpolacek 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).