public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/110307] New: ICE in move_insn, at haifa-sched.cc:5473 on alpha with -fPIC -fpeephole2 -fschedule-insns2
@ 2023-06-19  7:08 matoro_gcc_bugzilla at matoro dot tk
  2023-06-19 11:13 ` [Bug rtl-optimization/110307] " amonakov at gcc dot gnu.org
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: matoro_gcc_bugzilla at matoro dot tk @ 2023-06-19  7:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110307
           Summary: ICE in move_insn, at haifa-sched.cc:5473 on alpha with
                    -fPIC -fpeephole2 -fschedule-insns2
           Product: gcc
           Version: 13.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: matoro_gcc_bugzilla at matoro dot tk
  Target Milestone: ---

Minimized reproducer:

$ cat test.c
_Thread_local struct rb_execution_context_struct ruby_current_ec;
struct rb_execution_context_struct {
  int fiber_ptr
} rb_fiber_start() {
  __builtin_setjmp(0);
  if (ruby_current_ec.fiber_ptr)
    root_fiber_alloc();
}

$ alpha-unknown-linux-gnu-gcc -O1 -fpeephole2 -fschedule-insns2 -fPIC test.c -o
test.o -c
test.c:4:1: warning: no semicolon at end of struct or union
    4 | } rb_fiber_start() {
      | ^
test.c: In function ‘rb_fiber_start’:
test.c:7:5: warning: implicit declaration of function ‘root_fiber_alloc’
[-Wimplicit-function-declaration]
    7 |     root_fiber_alloc();
      |     ^~~~~~~~~~~~~~~~
during RTL pass: sched2
test.c:8:1: internal compiler error: in move_insn, at haifa-sched.cc:5473
    8 | }
      | ^


-fPIC is required to reproduce, as well as both -fpeephole2 and
-fschedule-insns2 optimizers (or simply -O2 which includes them).  Removing any
of those three flags no longer reproduces.  If required I can also work on
getting a complete stack trace.  If somebody would like to take a look at this
without the appropriate hardware, mine is publicly available for use.


$ alpha-unknown-linux-gnu-gcc --version --verbose
Using built-in specs.
COLLECT_AS_OPTIONS='--version'
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/alpha-unknown-linux-gnu/13/lto-wrapper
gcc (Gentoo 13.1.1_p20230527 p3) 13.1.1 20230527
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Target: alpha-unknown-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-13.1.1_p20230527/work/gcc-13-20230527/configure
--host=alpha-unknown-linux-gnu --build=alpha-unknown-linux-gnu --prefix=/usr
--bindir=/usr/alpha-unknown-linux-gnu/gcc-bin/13
--includedir=/usr/lib/gcc/alpha-unknown-linux-gnu/13/include
--datadir=/usr/share/gcc-data/alpha-unknown-linux-gnu/13
--mandir=/usr/share/gcc-data/alpha-unknown-linux-gnu/13/man
--infodir=/usr/share/gcc-data/alpha-unknown-linux-gnu/13/info
--with-gxx-include-dir=/usr/lib/gcc/alpha-unknown-linux-gnu/13/include/g++-v13
--with-python-dir=/share/gcc-data/alpha-unknown-linux-gnu/13/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
13.1.1_p20230527 p3' --with-gcc-major-version-only --disable-esp
--enable-libstdcxx-time --enable-lto --disable-libstdcxx-pch --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
--disable-multilib --disable-fixed-point --enable-libgomp --disable-libssp
--disable-libada --disable-cet --disable-systemtap
--disable-valgrind-annotations --disable-vtable-verify --disable-libvtv
--without-zstd --without-isl --disable-libsanitizer --enable-default-pie
--disable-default-ssp
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.1.1 20230527 (Gentoo 13.1.1_p20230527 p3) 
COLLECT_GCC_OPTIONS='--version' '-v' '-dumpdir' 'a-'
 /usr/libexec/gcc/alpha-unknown-linux-gnu/13/cc1 -quiet -v help-dummy -quiet
-dumpdir a- -dumpbase help-dummy -version --version -o /tmp/ccNd1lqC.s
GNU C17 (Gentoo 13.1.1_p20230527 p3) version 13.1.1 20230527
(alpha-unknown-linux-gnu)
        compiled by GNU C version 13.1.1 20230527, GMP version 6.2.1, MPFR
version 4.2.0-p9, MPC version 1.3.1, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
COLLECT_GCC_OPTIONS='--version' '-v' '-dumpdir' 'a-'

/usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../../alpha-unknown-linux-gnu/bin/as
-v --version -o /tmp/ccq4Tbtn.o /tmp/ccNd1lqC.s
GNU assembler version 2.40.0 (alpha-unknown-linux-gnu) using BFD version
(Gentoo 2.40 p5) 2.40.0
GNU assembler (Gentoo 2.40 p5) 2.40.0
Copyright (C) 2023 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or later.
This program has absolutely no warranty.
This assembler was configured for a target of `alpha-unknown-linux-gnu'.
COMPILER_PATH=/usr/libexec/gcc/alpha-unknown-linux-gnu/13/:/usr/libexec/gcc/alpha-unknown-linux-gnu/13/:/usr/libexec/gcc/alpha-unknown-linux-gnu/:/usr/lib/gcc/alpha-unknown-linux-gnu/13/:/usr/lib/gcc/alpha-unknown-linux-gnu/:/usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../../alpha-unknown-linux-gnu/bin/
LIBRARY_PATH=/usr/lib/gcc/alpha-unknown-linux-gnu/13/:/usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../../alpha-unknown-linux-gnu/lib/:/usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='--version' '-v' '-dumpdir' 'a.'
 /usr/libexec/gcc/alpha-unknown-linux-gnu/13/collect2 -plugin
/usr/libexec/gcc/alpha-unknown-linux-gnu/13/liblto_plugin.so
-plugin-opt=/usr/libexec/gcc/alpha-unknown-linux-gnu/13/lto-wrapper
-plugin-opt=-fresolution=/tmp/cckUzA7Z.res -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
--eh-frame-hdr -m elf64alpha -O1 -dynamic-linker /lib/ld-linux.so.2 -pie
--version /usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../crt1.o
/usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../crti.o
/usr/lib/gcc/alpha-unknown-linux-gnu/13/crtbegin.o
-L/usr/lib/gcc/alpha-unknown-linux-gnu/13
-L/usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../../alpha-unknown-linux-gnu/lib
-L/usr/lib/gcc/alpha-unknown-linux-gnu/13/../../.. /tmp/ccq4Tbtn.o -lgcc
--push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed
-lgcc_s --pop-state /usr/lib/gcc/alpha-unknown-linux-gnu/13/crtend.o
/usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../crtn.o
collect2 version 13.1.1 20230527
/usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../../alpha-unknown-linux-gnu/bin/ld
-plugin /usr/libexec/gcc/alpha-unknown-linux-gnu/13/liblto_plugin.so
-plugin-opt=/usr/libexec/gcc/alpha-unknown-linux-gnu/13/lto-wrapper
-plugin-opt=-fresolution=/tmp/cckUzA7Z.res -plugin-opt=-pass-through=-lgcc
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s
--eh-frame-hdr -m elf64alpha -O1 -dynamic-linker /lib/ld-linux.so.2 -pie
--version /usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../crt1.o
/usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../crti.o
/usr/lib/gcc/alpha-unknown-linux-gnu/13/crtbegin.o
-L/usr/lib/gcc/alpha-unknown-linux-gnu/13
-L/usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../../alpha-unknown-linux-gnu/lib
-L/usr/lib/gcc/alpha-unknown-linux-gnu/13/../../.. /tmp/ccq4Tbtn.o -lgcc
--push-state --as-needed -lgcc_s --pop-state -lc -lgcc --push-state --as-needed
-lgcc_s --pop-state /usr/lib/gcc/alpha-unknown-linux-gnu/13/crtend.o
/usr/lib/gcc/alpha-unknown-linux-gnu/13/../../../crtn.o
GNU ld (Gentoo 2.40 p5) 2.40.0
Copyright (C) 2023 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
COLLECT_GCC_OPTIONS='--version' '-v' '-dumpdir' 'a.'

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

* [Bug rtl-optimization/110307] ICE in move_insn, at haifa-sched.cc:5473 on alpha with -fPIC -fpeephole2 -fschedule-insns2
  2023-06-19  7:08 [Bug rtl-optimization/110307] New: ICE in move_insn, at haifa-sched.cc:5473 on alpha with -fPIC -fpeephole2 -fschedule-insns2 matoro_gcc_bugzilla at matoro dot tk
@ 2023-06-19 11:13 ` amonakov at gcc dot gnu.org
  2023-06-19 20:28 ` [Bug rtl-optimization/110307] ICE in move_insn, at haifa-sched.cc:5473 when building Ruby on alpha with -fPIC -O2 (or -fpeephole2 -fschedule-insns2) matoro_gcc_bugzilla at matoro dot tk
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: amonakov at gcc dot gnu.org @ 2023-06-19 11:13 UTC (permalink / raw)
  To: gcc-bugs

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

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amonakov at gcc dot gnu.org

--- Comment #1 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
I tried building a cross-compiler from trunk with
--target=alpha-unknown-linux-gnu --with-gnu-ld --with-gnu-as --enable-secureplt
--enable-languages=c --enable-tls and got

t.c:8:1: error: unrecognizable insn:
    8 | }
      | ^
(insn 23 22 24 5 (set (reg/f:DI 74)
        (symbol_ref:DI ("ruby_current_ec") [flags 0x10]  <var_decl
0x7fb457a6c090 ruby_current_ec>)) "t.c":6:22 -1
     (nil))
during RTL pass: vregs

Would you mind compiling the testcase with -fdump-tree-all -fdump-rtl-all and
attaching a tar.gz with the resulting dumps?

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

* [Bug rtl-optimization/110307] ICE in move_insn, at haifa-sched.cc:5473 when building Ruby on alpha with -fPIC -O2 (or -fpeephole2 -fschedule-insns2)
  2023-06-19  7:08 [Bug rtl-optimization/110307] New: ICE in move_insn, at haifa-sched.cc:5473 on alpha with -fPIC -fpeephole2 -fschedule-insns2 matoro_gcc_bugzilla at matoro dot tk
  2023-06-19 11:13 ` [Bug rtl-optimization/110307] " amonakov at gcc dot gnu.org
@ 2023-06-19 20:28 ` matoro_gcc_bugzilla at matoro dot tk
  2023-06-19 22:07 ` amonakov at gcc dot gnu.org
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: matoro_gcc_bugzilla at matoro dot tk @ 2023-06-19 20:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from matoro <matoro_gcc_bugzilla at matoro dot tk> ---
Created attachment 55365
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55365&action=edit
archive from -fdump-tree-all -fdump-rtl-all

(In reply to Alexander Monakov from comment #1)
> I tried building a cross-compiler from trunk with
> --target=alpha-unknown-linux-gnu --with-gnu-ld --with-gnu-as
> --enable-secureplt --enable-languages=c --enable-tls and got
> 
> t.c:8:1: error: unrecognizable insn:
>     8 | }
>       | ^
> (insn 23 22 24 5 (set (reg/f:DI 74)
>         (symbol_ref:DI ("ruby_current_ec") [flags 0x10]  <var_decl
> 0x7fb457a6c090 ruby_current_ec>)) "t.c":6:22 -1
>      (nil))
> during RTL pass: vregs
> 
> Would you mind compiling the testcase with -fdump-tree-all -fdump-rtl-all
> and attaching a tar.gz with the resulting dumps?

Absolutely, here you go.

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

* [Bug rtl-optimization/110307] ICE in move_insn, at haifa-sched.cc:5473 when building Ruby on alpha with -fPIC -O2 (or -fpeephole2 -fschedule-insns2)
  2023-06-19  7:08 [Bug rtl-optimization/110307] New: ICE in move_insn, at haifa-sched.cc:5473 on alpha with -fPIC -fpeephole2 -fschedule-insns2 matoro_gcc_bugzilla at matoro dot tk
  2023-06-19 11:13 ` [Bug rtl-optimization/110307] " amonakov at gcc dot gnu.org
  2023-06-19 20:28 ` [Bug rtl-optimization/110307] ICE in move_insn, at haifa-sched.cc:5473 when building Ruby on alpha with -fPIC -O2 (or -fpeephole2 -fschedule-insns2) matoro_gcc_bugzilla at matoro dot tk
@ 2023-06-19 22:07 ` amonakov at gcc dot gnu.org
  2023-06-19 23:02 ` matoro_gcc_bugzilla at matoro dot tk
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: amonakov at gcc dot gnu.org @ 2023-06-19 22:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
Do you have older versions of GCC to check on this testcase?

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

* [Bug rtl-optimization/110307] ICE in move_insn, at haifa-sched.cc:5473 when building Ruby on alpha with -fPIC -O2 (or -fpeephole2 -fschedule-insns2)
  2023-06-19  7:08 [Bug rtl-optimization/110307] New: ICE in move_insn, at haifa-sched.cc:5473 on alpha with -fPIC -fpeephole2 -fschedule-insns2 matoro_gcc_bugzilla at matoro dot tk
                   ` (2 preceding siblings ...)
  2023-06-19 22:07 ` amonakov at gcc dot gnu.org
@ 2023-06-19 23:02 ` matoro_gcc_bugzilla at matoro dot tk
  2023-06-20  9:03 ` amonakov at gcc dot gnu.org
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: matoro_gcc_bugzilla at matoro dot tk @ 2023-06-19 23:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from matoro <matoro_gcc_bugzilla at matoro dot tk> ---
(In reply to Alexander Monakov from comment #3)
> Do you have older versions of GCC to check on this testcase?

No, for the same reason I didn't get a complete backtrace, it takes a while to
compile on this machine.  I can go ahead and kick it off though, and update
with results as I find them.

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

* [Bug rtl-optimization/110307] ICE in move_insn, at haifa-sched.cc:5473 when building Ruby on alpha with -fPIC -O2 (or -fpeephole2 -fschedule-insns2)
  2023-06-19  7:08 [Bug rtl-optimization/110307] New: ICE in move_insn, at haifa-sched.cc:5473 on alpha with -fPIC -fpeephole2 -fschedule-insns2 matoro_gcc_bugzilla at matoro dot tk
                   ` (3 preceding siblings ...)
  2023-06-19 23:02 ` matoro_gcc_bugzilla at matoro dot tk
@ 2023-06-20  9:03 ` amonakov at gcc dot gnu.org
  2023-06-20 16:42 ` amonakov at gcc dot gnu.org
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: amonakov at gcc dot gnu.org @ 2023-06-20  9:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
It's not necessary yet for this particular bug, but might be helpful for future
bugs (if disk space is not an issue).

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

* [Bug rtl-optimization/110307] ICE in move_insn, at haifa-sched.cc:5473 when building Ruby on alpha with -fPIC -O2 (or -fpeephole2 -fschedule-insns2)
  2023-06-19  7:08 [Bug rtl-optimization/110307] New: ICE in move_insn, at haifa-sched.cc:5473 on alpha with -fPIC -fpeephole2 -fschedule-insns2 matoro_gcc_bugzilla at matoro dot tk
                   ` (4 preceding siblings ...)
  2023-06-20  9:03 ` amonakov at gcc dot gnu.org
@ 2023-06-20 16:42 ` amonakov at gcc dot gnu.org
  2023-06-20 21:45 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: amonakov at gcc dot gnu.org @ 2023-06-20 16:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
Cross-compiler needs HAVE_AS_EXPLICIT_RELOCS=1.

With checking enabled, we get:

t.c:8:1: error: flow control insn inside a basic block
(call_insn 97 96 98 4 (parallel [
            (set (reg:DI 0 $0)
                (call (mem:DI (reg:DI 27 $27) [0  S8 A64])
                    (const_int 0 [0])))
            (set (reg:DI 29 $29)
                (unspec:DI [
                        (reg:DI 29 $29)
                        (const_int 6 [0x6])
                    ] UNSPEC_LDGP1))
            (use (symbol_ref:DI ("__tls_get_addr") [flags 0x41]  <function_decl
0x7f642d9ec400 __tls_get_addr>))
            (use (unspec [
                        (const_int 1 [0x1])
                    ] UNSPEC_TLSGD_CALL))
            (clobber (reg:DI 26 $26))
        ]) "t.c":6:22 -1
     (nil)
    (expr_list (use (reg:DI 16 $16))
        (nil)))
during RTL pass: peephole2
dump file: t.c.313r.peephole2
t.c:8:1: internal compiler error: in rtl_verify_bb_insns, at cfgrtl.cc:2797


Insn 96 appears via:

Splitting with gen_peephole2_8 (alpha.md:5972)
scanning new insn with uid = 96.
scanning new insn with uid = 97.
scanning new insn with uid = 98.
deleting insn with uid = 25.

Insn 25 was:

(call_insn/u 25 39 26 4 (parallel [
            (set (reg:DI 0 $0)
                (call (mem:DI (symbol_ref:DI ("__tls_get_addr") [flags 0x41] 
<function_decl 0x7f642d9ec400 __tls_get_addr>) [0  S8 A64])
                    (const_int 0 [0])))
            (unspec [
                    (const_int 1 [0x1])
                ] UNSPEC_TLSGD_CALL)
            (use (reg:DI 29 $29))
            (clobber (reg:DI 26 $26))
        ]) "t.c":6:22 346 {call_value_osf_tlsgd}
     (expr_list:REG_DEAD (reg:DI 16 $16)
        (expr_list:REG_EH_REGION (const_int -2147483648 [0xffffffff80000000])
            (nil)))
    (expr_list (use (reg:DI 16 $16))
        (nil)))

Note the REG_EH_REGION. This is relevant because can_nonlocal_goto checks it,
so for insn 25 we knew it wouldn't return to the setjmp receiver. Applying the
peephole dropped the note.

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

* [Bug rtl-optimization/110307] ICE in move_insn, at haifa-sched.cc:5473 when building Ruby on alpha with -fPIC -O2 (or -fpeephole2 -fschedule-insns2)
  2023-06-19  7:08 [Bug rtl-optimization/110307] New: ICE in move_insn, at haifa-sched.cc:5473 on alpha with -fPIC -fpeephole2 -fschedule-insns2 matoro_gcc_bugzilla at matoro dot tk
                   ` (5 preceding siblings ...)
  2023-06-20 16:42 ` amonakov at gcc dot gnu.org
@ 2023-06-20 21:45 ` pinskia at gcc dot gnu.org
  2023-06-21 11:08 ` amonakov at gcc dot gnu.org
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-20 21:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Alexander Monakov from comment #6) 
> Note the REG_EH_REGION. This is relevant because can_nonlocal_goto checks
> it, so for insn 25 we knew it wouldn't return to the setjmp receiver.
> Applying the peephole dropped the note.

This should fix it but there might be other REG notes that need to be copied
still:
apinski@xeond:~/src/upstream-gcc/gcc/gcc$ git diff recog.cc
diff --git a/gcc/recog.cc b/gcc/recog.cc
index 37432087812..4bad4a59057 100644
--- a/gcc/recog.cc
+++ b/gcc/recog.cc
@@ -3921,6 +3921,7 @@ peep2_attempt (basic_block bb, rtx_insn *insn, int
match_len, rtx_insn *attempt)
          {
          case REG_NORETURN:
          case REG_SETJMP:
+         case REG_EH_REGION:
          case REG_TM:
          case REG_CALL_NOCF_CHECK:
            add_reg_note (new_insn, REG_NOTE_KIND (note),

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

* [Bug rtl-optimization/110307] ICE in move_insn, at haifa-sched.cc:5473 when building Ruby on alpha with -fPIC -O2 (or -fpeephole2 -fschedule-insns2)
  2023-06-19  7:08 [Bug rtl-optimization/110307] New: ICE in move_insn, at haifa-sched.cc:5473 on alpha with -fPIC -fpeephole2 -fschedule-insns2 matoro_gcc_bugzilla at matoro dot tk
                   ` (6 preceding siblings ...)
  2023-06-20 21:45 ` pinskia at gcc dot gnu.org
@ 2023-06-21 11:08 ` amonakov at gcc dot gnu.org
  2023-06-22 14:53 ` matoro_gcc_bugzilla at matoro dot tk
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: amonakov at gcc dot gnu.org @ 2023-06-21 11:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
REG_EH_REGION is handled further down that function, but
copy_reg_eh_region_note_backward does not copy the note. Perhaps it needs

diff --git a/gcc/except.cc b/gcc/except.cc
index e728aa43b6..cfe140c4d0 100644
--- a/gcc/except.cc
+++ b/gcc/except.cc
@@ -1795,7 +1795,7 @@ copy_reg_eh_region_note_backward (rtx note_or_insn,
rtx_insn *last, rtx first)
   note = XEXP (note, 0);

   for (insn = last; insn != first; insn = PREV_INSN (insn))
-    if (insn_could_throw_p (insn))
+    if (insn_could_throw_p (insn) || can_nonlocal_goto (insn))
       add_reg_note (insn, REG_EH_REGION, note);
 }

?

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

* [Bug rtl-optimization/110307] ICE in move_insn, at haifa-sched.cc:5473 when building Ruby on alpha with -fPIC -O2 (or -fpeephole2 -fschedule-insns2)
  2023-06-19  7:08 [Bug rtl-optimization/110307] New: ICE in move_insn, at haifa-sched.cc:5473 on alpha with -fPIC -fpeephole2 -fschedule-insns2 matoro_gcc_bugzilla at matoro dot tk
                   ` (7 preceding siblings ...)
  2023-06-21 11:08 ` amonakov at gcc dot gnu.org
@ 2023-06-22 14:53 ` matoro_gcc_bugzilla at matoro dot tk
  2023-06-22 15:55 ` amonakov at gcc dot gnu.org
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: matoro_gcc_bugzilla at matoro dot tk @ 2023-06-22 14:53 UTC (permalink / raw)
  To: gcc-bugs

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

matoro <matoro_gcc_bugzilla at matoro dot tk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |12.3.1, 13.1.1

--- Comment #9 from matoro <matoro_gcc_bugzilla at matoro dot tk> ---
I have a gcc 12 build, this does repro there as well.  Assertions enabled on
this one so I see the same instruction dump now.  It takes about 2 days, so I
will go ahead and kick off a build of 13 with those two patches mentioned
above.  Any other changes I should include in the build?

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

* [Bug rtl-optimization/110307] ICE in move_insn, at haifa-sched.cc:5473 when building Ruby on alpha with -fPIC -O2 (or -fpeephole2 -fschedule-insns2)
  2023-06-19  7:08 [Bug rtl-optimization/110307] New: ICE in move_insn, at haifa-sched.cc:5473 on alpha with -fPIC -fpeephole2 -fschedule-insns2 matoro_gcc_bugzilla at matoro dot tk
                   ` (8 preceding siblings ...)
  2023-06-22 14:53 ` matoro_gcc_bugzilla at matoro dot tk
@ 2023-06-22 15:55 ` amonakov at gcc dot gnu.org
  2023-06-22 16:17 ` matoro_gcc_bugzilla at matoro dot tk
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: amonakov at gcc dot gnu.org @ 2023-06-22 15:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
I think the first patch may result in duplicated notes, so I wouldn't recommend
picking it.

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

* [Bug rtl-optimization/110307] ICE in move_insn, at haifa-sched.cc:5473 when building Ruby on alpha with -fPIC -O2 (or -fpeephole2 -fschedule-insns2)
  2023-06-19  7:08 [Bug rtl-optimization/110307] New: ICE in move_insn, at haifa-sched.cc:5473 on alpha with -fPIC -fpeephole2 -fschedule-insns2 matoro_gcc_bugzilla at matoro dot tk
                   ` (9 preceding siblings ...)
  2023-06-22 15:55 ` amonakov at gcc dot gnu.org
@ 2023-06-22 16:17 ` matoro_gcc_bugzilla at matoro dot tk
  2023-06-25 16:39 ` matoro_gcc_bugzilla at matoro dot tk
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: matoro_gcc_bugzilla at matoro dot tk @ 2023-06-22 16:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from matoro <matoro_gcc_bugzilla at matoro dot tk> ---
(In reply to Alexander Monakov from comment #10)
> I think the first patch may result in duplicated notes, so I wouldn't
> recommend picking it.

Oh okay, so just the second patch then?  Let me try that.

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

* [Bug rtl-optimization/110307] ICE in move_insn, at haifa-sched.cc:5473 when building Ruby on alpha with -fPIC -O2 (or -fpeephole2 -fschedule-insns2)
  2023-06-19  7:08 [Bug rtl-optimization/110307] New: ICE in move_insn, at haifa-sched.cc:5473 on alpha with -fPIC -fpeephole2 -fschedule-insns2 matoro_gcc_bugzilla at matoro dot tk
                   ` (10 preceding siblings ...)
  2023-06-22 16:17 ` matoro_gcc_bugzilla at matoro dot tk
@ 2023-06-25 16:39 ` matoro_gcc_bugzilla at matoro dot tk
  2023-06-25 16:46 ` amonakov at gcc dot gnu.org
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: matoro_gcc_bugzilla at matoro dot tk @ 2023-06-25 16:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from matoro <matoro_gcc_bugzilla at matoro dot tk> ---
Just tested applying this patch on top of 13 and it worked!  Thanks so much for
the help!

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

* [Bug rtl-optimization/110307] ICE in move_insn, at haifa-sched.cc:5473 when building Ruby on alpha with -fPIC -O2 (or -fpeephole2 -fschedule-insns2)
  2023-06-19  7:08 [Bug rtl-optimization/110307] New: ICE in move_insn, at haifa-sched.cc:5473 on alpha with -fPIC -fpeephole2 -fschedule-insns2 matoro_gcc_bugzilla at matoro dot tk
                   ` (11 preceding siblings ...)
  2023-06-25 16:39 ` matoro_gcc_bugzilla at matoro dot tk
@ 2023-06-25 16:46 ` amonakov at gcc dot gnu.org
  2023-11-10 21:37 ` sjames at gcc dot gnu.org
  2023-11-11  9:01 ` amonakov at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: amonakov at gcc dot gnu.org @ 2023-06-25 16:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
Note to self: check how control_flow_insn_p relates.

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

* [Bug rtl-optimization/110307] ICE in move_insn, at haifa-sched.cc:5473 when building Ruby on alpha with -fPIC -O2 (or -fpeephole2 -fschedule-insns2)
  2023-06-19  7:08 [Bug rtl-optimization/110307] New: ICE in move_insn, at haifa-sched.cc:5473 on alpha with -fPIC -fpeephole2 -fschedule-insns2 matoro_gcc_bugzilla at matoro dot tk
                   ` (12 preceding siblings ...)
  2023-06-25 16:46 ` amonakov at gcc dot gnu.org
@ 2023-11-10 21:37 ` sjames at gcc dot gnu.org
  2023-11-11  9:01 ` amonakov at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-11-10 21:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Sam James <sjames at gcc dot gnu.org> ---
(In reply to Alexander Monakov from comment #13)
> Note to self: check how control_flow_insn_p relates.

Did you have a chance to look at this bit? matoro asked me to cherry-pick it
downstream but it's in generic code from a skim so...

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

* [Bug rtl-optimization/110307] ICE in move_insn, at haifa-sched.cc:5473 when building Ruby on alpha with -fPIC -O2 (or -fpeephole2 -fschedule-insns2)
  2023-06-19  7:08 [Bug rtl-optimization/110307] New: ICE in move_insn, at haifa-sched.cc:5473 on alpha with -fPIC -fpeephole2 -fschedule-insns2 matoro_gcc_bugzilla at matoro dot tk
                   ` (13 preceding siblings ...)
  2023-11-10 21:37 ` sjames at gcc dot gnu.org
@ 2023-11-11  9:01 ` amonakov at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: amonakov at gcc dot gnu.org @ 2023-11-11  9:01 UTC (permalink / raw)
  To: gcc-bugs

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

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uros at gcc dot gnu.org

--- Comment #15 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
It did not bring enlightenment. It looks like INT_MIN REG_EH_REGION annotating
a call that *does not* perform a non-local goto was a late addition, breaking
the assumption "EH_REGION notes may appear only on insns that may throw
exceptions", and now a few places in the compiler look as if they may forget to
preserve the special INT_MIN REG_EH_REGION note.

Uros, would you mind reading the discussion in this bug? Do you have
suggestions how to proceed here?

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

end of thread, other threads:[~2023-11-11  9:01 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-19  7:08 [Bug rtl-optimization/110307] New: ICE in move_insn, at haifa-sched.cc:5473 on alpha with -fPIC -fpeephole2 -fschedule-insns2 matoro_gcc_bugzilla at matoro dot tk
2023-06-19 11:13 ` [Bug rtl-optimization/110307] " amonakov at gcc dot gnu.org
2023-06-19 20:28 ` [Bug rtl-optimization/110307] ICE in move_insn, at haifa-sched.cc:5473 when building Ruby on alpha with -fPIC -O2 (or -fpeephole2 -fschedule-insns2) matoro_gcc_bugzilla at matoro dot tk
2023-06-19 22:07 ` amonakov at gcc dot gnu.org
2023-06-19 23:02 ` matoro_gcc_bugzilla at matoro dot tk
2023-06-20  9:03 ` amonakov at gcc dot gnu.org
2023-06-20 16:42 ` amonakov at gcc dot gnu.org
2023-06-20 21:45 ` pinskia at gcc dot gnu.org
2023-06-21 11:08 ` amonakov at gcc dot gnu.org
2023-06-22 14:53 ` matoro_gcc_bugzilla at matoro dot tk
2023-06-22 15:55 ` amonakov at gcc dot gnu.org
2023-06-22 16:17 ` matoro_gcc_bugzilla at matoro dot tk
2023-06-25 16:39 ` matoro_gcc_bugzilla at matoro dot tk
2023-06-25 16:46 ` amonakov at gcc dot gnu.org
2023-11-10 21:37 ` sjames at gcc dot gnu.org
2023-11-11  9:01 ` amonakov 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).