public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/112400] New: VAX: ICE in fixup_reorder_chain, at cfgrtl.cc:4025, whilst building gimple_match.cc
@ 2023-11-06  3:38 kalvisd at gmail dot com
  2023-11-06  3:38 ` [Bug target/112400] " kalvisd at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: kalvisd at gmail dot com @ 2023-11-06  3:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112400
           Summary: VAX: ICE in fixup_reorder_chain, at cfgrtl.cc:4025,
                    whilst building gimple_match.cc
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kalvisd at gmail dot com
  Target Milestone: ---

Created attachment 56511
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56511&action=edit
Reduced test case

GCC was built as below, on amd64 targeting vax:

$ /mnt/gcc/x86_64/bin/vax--netbsdelf-g++ -v
Using built-in specs.
COLLECT_GCC=/mnt/gcc/x86_64/bin/vax--netbsdelf-g++
COLLECT_LTO_WRAPPER=/mnt/gcc/x86_64/bin/../libexec/gcc/vax--netbsdelf/12.2.0/lto-wrapper
Target: vax--netbsdelf
Configured with: ../gcc-12.2.0/configure --prefix=/mnt/gcc/12/../x86_64
--target=vax--netbsdelf --enable-long-long --enable-threads --with-system-zlib
--without-isl --enable-__cxa_atexit --enable-libstdcxx-time=rt
--enable-libstdcxx-threads --with-diagnostics-color=auto-if-env
--with-default-libstdcxx-abi=new
--with-sysroot=/srv/nfs/netbsd-git/build/obj.vax/srv/nfs/netbsd-git/src/destdir.vax
--disable-nls --disable-multilib
--program-transform-name=''\''s,^,vax--netbsdelf-,'\'''
--with-mpc=/mnt/gcc/12/../x86_64 --with-mpfr=/mnt/gcc/12/../x86_64
--with-gmp=/mnt/gcc/12/../x86_64 --with-isl=/mnt/gcc/12/../x86_64
--srcdir=/mnt/gcc/12/gcc-12.2.0-x86_64-vax--netbsdelf/../gcc-12.2.0
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.2.0 (GCC) 

Output from GCC when it generated the ICE:

/mnt/gcc/x86_64/bin/vax--netbsdelf-g++  -O2 -fpic -fPIC -o gimple-match.s -S
gimple-match.i
gimple-match.i: In function 'bool ah(x*, b*, a (*)(a), a, a*, k)':
gimple-match.i:22:44: warning: no return statement in function returning
non-void [-Wreturn-type]
   22 | static bool ah(x *, b *, a(a), a, a *, k) {}
      |                                            ^
gimple-match.i: In function 'bool ai(x*, a (*)(a))':
gimple-match.i:92:1: warning: control reaches end of non-void function
[-Wreturn-type]
   92 | }
      | ^
during RTL pass: bbro
gimple-match.i:92:1: internal compiler error: in fixup_reorder_chain, at
cfgrtl.cc:4025
0x5bc784 fixup_reorder_chain
       
/mnt/gcc/12/gcc-12.2.0-x86_64-vax--netbsdelf/../gcc-12.2.0/gcc/cfgrtl.cc:4025
0x5bc784 cfg_layout_finalize()
       
/mnt/gcc/12/gcc-12.2.0-x86_64-vax--netbsdelf/../gcc-12.2.0/gcc/cfgrtl.cc:4538
0x1276008 execute
       
/mnt/gcc/12/gcc-12.2.0-x86_64-vax--netbsdelf/../gcc-12.2.0/gcc/bb-reorder.cc:2663
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.
make: *** [Makefile:47: gimple-match.s] Error 1


Compiler invoked using

 /mnt/gcc/x86_64/bin/vax--netbsdelf-g++  -O2 -fpic -fPIC  -o gimple-match.s -S
gimple-match.i

The reduced input file is attached as gimple-match.i

The root cause seems to be an incompletely removed computed jump instruction;
the 'jump2' phase was able to remove the related table of jump offsets but not
the jump itself, and this appears to be because onlyjump_p() did not recognise
the computed jump instruction.

The RTX for a computed jump instruction on VAX is something like this:

    (jump_insn 10499 6387 3048 558 (parallel [
                (const_int 3 [0x3])
                (set (pc)
                    (plus:SI (sign_extend:SI (mem:HI (plus:SI (mult:SI (reg:SI
0 %r0 [1385])
                                        (const_int 2 [0x2]))
                                    (pc)) [0  S2 A8]))
                        (label_ref:SI 3048)))
                (clobber (reg:CC 16 %psl))
                (use (label_ref:SI 3048))
            ]) 573 {*casesi1}
         (expr_list:REG_DEAD (reg:SI 0 %r0 [1385])
            (expr_list:REG_UNUSED (reg:CC 16 %psl)
                (nil)))
     -> 3048)

onlyjump_p() will recognise jump instructions if and only if there is one set
expression, zero or more use or clobber expressions, and no other expression
types.

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

* [Bug target/112400] VAX: ICE in fixup_reorder_chain, at cfgrtl.cc:4025, whilst building gimple_match.cc
  2023-11-06  3:38 [Bug target/112400] New: VAX: ICE in fixup_reorder_chain, at cfgrtl.cc:4025, whilst building gimple_match.cc kalvisd at gmail dot com
@ 2023-11-06  3:38 ` kalvisd at gmail dot com
  2023-11-06  3:41 ` pinskia at gcc dot gnu.org
  2023-11-06  3:45 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: kalvisd at gmail dot com @ 2023-11-06  3:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Kalvis Duckmanton <kalvisd at gmail dot com> ---
Created attachment 56512
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56512&action=edit
patch proposed as solution

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

* [Bug target/112400] VAX: ICE in fixup_reorder_chain, at cfgrtl.cc:4025, whilst building gimple_match.cc
  2023-11-06  3:38 [Bug target/112400] New: VAX: ICE in fixup_reorder_chain, at cfgrtl.cc:4025, whilst building gimple_match.cc kalvisd at gmail dot com
  2023-11-06  3:38 ` [Bug target/112400] " kalvisd at gmail dot com
@ 2023-11-06  3:41 ` pinskia at gcc dot gnu.org
  2023-11-06  3:45 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-06  3:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Patches should be posted to gcc-patches@ after reading
https://gcc.gnu.org/contribute.html .

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

* [Bug target/112400] VAX: ICE in fixup_reorder_chain, at cfgrtl.cc:4025, whilst building gimple_match.cc
  2023-11-06  3:38 [Bug target/112400] New: VAX: ICE in fixup_reorder_chain, at cfgrtl.cc:4025, whilst building gimple_match.cc kalvisd at gmail dot com
  2023-11-06  3:38 ` [Bug target/112400] " kalvisd at gmail dot com
  2023-11-06  3:41 ` pinskia at gcc dot gnu.org
@ 2023-11-06  3:45 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-06  3:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks like it was introduced with r0-63993-g05dde071b32f .

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

end of thread, other threads:[~2023-11-06  3:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-06  3:38 [Bug target/112400] New: VAX: ICE in fixup_reorder_chain, at cfgrtl.cc:4025, whilst building gimple_match.cc kalvisd at gmail dot com
2023-11-06  3:38 ` [Bug target/112400] " kalvisd at gmail dot com
2023-11-06  3:41 ` pinskia at gcc dot gnu.org
2023-11-06  3:45 ` pinskia 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).