public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Modula-2 / Rust: Many targets failing
@ 2022-12-19 21:23 Jan-Benedict Glaw
  2023-02-22 11:25 ` Rust: In 'type_for_mode' langhook also consider all 'int_n' modes/types (was: Modula-2 / Rust: Many targets failing) Thomas Schwinge
  0 siblings, 1 reply; 6+ messages in thread
From: Jan-Benedict Glaw @ 2022-12-19 21:23 UTC (permalink / raw)
  To: gcc-patches, Gaius Mulley, arthur.cohen

[-- Attachment #1: Type: text/plain, Size: 12505 bytes --]

Hi!

With the recent merges for Modula-2 and Rust, I see a good number of
targets failing with --enable-languages=all, mostly due to issues with
the Modula-2 driver.


 Modula-2 related issues
=========================


 --target=x86_64-apple-darwin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	/bin/bash ../../gcc/gcc/m2/tools-src/makeSystem -fpim \
	             ../../gcc/gcc/m2/gm2-libs/SYSTEM.def \
	             ../../gcc/gcc/m2/gm2-libs/SYSTEM.mod \
	             -I../../gcc/gcc/m2/gm2-libs \
	             "/var/lib/laminar/run/gcc-x86_64-apple-darwin/19/toolchain-build/./gcc/gm2 -B/var/lib/laminar/run/gcc-x86_64-apple-darwin/19/toolchain-build/./gcc/ " /var/lib/laminar/run/gcc-x86_64-apple-darwin/19/toolchain-build/gcc/m2/gm2-libs/SYSTEM.def
	/var/lib/laminar/run/gcc-x86_64-apple-darwin/19/toolchain-build/./gcc/as: 114: exec: -arch: not found
	SYSTEM module creates type: LOC
	SYSTEM module creates type: WORD
	SYSTEM module creates type: BYTE
	SYSTEM module creates type: ADDRESS
	SYSTEM module creates type: INTEGER8
	SYSTEM module creates type: INTEGER16
	SYSTEM module creates type: INTEGER32
	SYSTEM module creates type: INTEGER64
	SYSTEM module creates type: CARDINAL8
	SYSTEM module creates type: CARDINAL16
	SYSTEM module creates type: CARDINAL32
	SYSTEM module creates type: CARDINAL64
	SYSTEM module creates type: WORD16
	SYSTEM module creates type: WORD32
	SYSTEM module creates type: WORD64
	SYSTEM module creates type: BITSET8
	SYSTEM module creates type: BITSET16
	SYSTEM module creates type: BITSET32
	SYSTEM module creates type: REAL32
	SYSTEM module creates type: REAL64
	SYSTEM module creates type: REAL128
	SYSTEM module creates type: COMPLEX32
	SYSTEM module creates type: COMPLEX64
	SYSTEM module creates type: COMPLEX128
	SYSTEM module creates type: CSIZE_T
	SYSTEM module creates type: CSSIZE_T
	/var/lib/laminar/run/gcc-x86_64-apple-darwin/19/toolchain-build/./gcc/as: 114: exec: -arch: not found
	make[1]: *** [../../gcc/gcc/m2/Make-lang.in:1524: /var/lib/laminar/run/gcc-x86_64-apple-darwin/19/toolchain-build/gcc/m2/gm2-libs/SYSTEM.def] Error 1
	rm m2/gm2-compiler-boot/P2Build.mod m2/gm2-compiler-boot/P0SyntaxCheck.mod m2/gm2-compiler-boot/PCBuild.mod m2/gm2-compiler-boot/PHBuild.mod m2/gm2-compiler-boot/P1Build.mod m2/gm2-compiler-boot/P3Build.mod
	make[1]: Leaving directory '/var/lib/laminar/run/gcc-x86_64-apple-darwin/19/toolchain-build/gcc'
	make: *** [Makefile:4623: all-gcc] Error 2


 --target=sparc64-sun-solaris2.11 --with-gnu-ld --with-gnu-as --enable-threads=posix
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Similar to x86_64-apple-darwin, but:
	/var/lib/laminar/run/gcc-sparc64-sun-solaris2.11OPT-with-gnu-ldOPT-with-gnu-asOPT-enable-threads=posix/19/toolchain-install/sparc64-sun-solaris2.11/bin/as: unrecognized option '-m64'

 --target=sparc-sun-solaris2.11
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Similar to x86_64-apple-darwin, but:
	/var/lib/laminar/run/gcc-sparc-sun-solaris2.11/16/toolchain-install/sparc-sun-solaris2.11/bin/as: unrecognized option '-m32'

 --target=powerpc64-darwin
 --target=powerpc-darwin8
 --target=powerpc-darwin7
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Similar to x86_64-apple-darwin

 --target=powerpc-lynxos
~~~~~~~~~~~~~~~~~~~~~~~~~
Same place, but
	/var/lib/laminar/run/gcc-powerpc-lynxos/20/toolchain-build/./gcc/as: 114: exec: -I: not found

 --target=mipsisa64sr71k-elf
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Similar to the others:
	/bin/bash ../../gcc/gcc/m2/tools-src/makeSystem -fpim \
	             ../../gcc/gcc/m2/gm2-libs/SYSTEM.def \
	             ../../gcc/gcc/m2/gm2-libs/SYSTEM.mod \
	             -I../../gcc/gcc/m2/gm2-libs \
	             "/var/lib/laminar/run/gcc-mipsisa64sr71k-elf/23/toolchain-build/./gcc/gm2 -B/var/lib/laminar/run/gcc-mipsisa64sr71k-elf/23/toolchain-build/./gcc/ " /var/lib/laminar/run/gcc-mipsisa64sr71k-elf/23/toolchain-build/gcc/m2/gm2-libs/SYSTEM.def
	Assembler messages:
	Error: bad value (sr71k) for default CPU
	Internal error in mips_after_parse_args at config/tc-mips.c:15290.
	Please report this bug.

 --target=m32rle-elf
~~~~~~~~~~~~~~~~~~~~~
	/bin/bash ../../gcc/gcc/m2/tools-src/makeSystem -fpim \
	             ../../gcc/gcc/m2/gm2-libs/SYSTEM.def \
	             ../../gcc/gcc/m2/gm2-libs/SYSTEM.mod \
	             -I../../gcc/gcc/m2/gm2-libs \
	             "/var/lib/laminar/run/gcc-m32rle-elf/21/toolchain-build/./gcc/gm2 -B/var/lib/laminar/run/gcc-m32rle-elf/21/toolchain-build/./gcc/ " /var/lib/laminar/run/gcc-m32rle-elf/21/toolchain-build/gcc/m2/gm2-libs/SYSTEM.def
	/var/lib/laminar/run/gcc-m32rle-elf/21/toolchain-build/./gcc/as: 114: exec: --no-warn-explicit-parallel-conflicts: not found

 --target=i686-solaris2.11
 --target=i386-pc-solaris2.11
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Similar, but
	/var/lib/laminar/run/gcc-i686-solaris2.11/21/toolchain-install/i686-solaris2.11/bin/as: unrecognized option '-xarch=generic'

 --target=i686-apple-darwin
 --target=i686-apple-darwin9
 --target=i686-apple-darwin10
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	/bin/bash ../../gcc/gcc/m2/tools-src/makeSystem -fpim \
	             ../../gcc/gcc/m2/gm2-libs/SYSTEM.def \
	             ../../gcc/gcc/m2/gm2-libs/SYSTEM.mod \
	             -I../../gcc/gcc/m2/gm2-libs \
	             "/var/lib/laminar/run/gcc-i686-apple-darwin9/21/toolchain-build/./gcc/gm2 -B/var/lib/laminar/run/gcc-i686-apple-darwin9/21/toolchain-build/./gcc/ " /var/lib/laminar/run/gcc-i686-apple-darwin9/21/toolchain-build/gcc/m2/gm2-libs/SYSTEM.def
	Assembler messages:
	Fatal error: invalid listing option `r'

 --target=m32c-elf
~~~~~~~~~~~~~~~~~~~
	/bin/bash ../../gcc/gcc/m2/tools-src/makeSystem -fpim \
	             ../../gcc/gcc/m2/gm2-libs/SYSTEM.def \
	             ../../gcc/gcc/m2/gm2-libs/SYSTEM.mod \
	             -I../../gcc/gcc/m2/gm2-libs \
	             "/var/lib/laminar/run/gcc-m32c-elf/21/toolchain-build/./gcc/gm2 -B/var/lib/laminar/run/gcc-m32c-elf/21/toolchain-build/./gcc/ " /var/lib/laminar/run/gcc-m32c-elf/21/toolchain-build/gcc/m2/gm2-libs/SYSTEM.def
	during RTL pass: pro_and_epilogue
	<built-in>: In function '_M2_SYSTEM_init':
	<built-in>: internal compiler error: in leaf_function_p, at final.cc:4054
	0x5d48dd leaf_function_p()
	      ../../gcc/gcc/final.cc:4054
	0x105c30c m32c_leaf_function_p
	      ../../gcc/gcc/config/m32c/m32c.cc:4018
	0x105c30c m32c_emit_prologue()
	      ../../gcc/gcc/config/m32c/m32c.cc:4072
	0x14a10da gen_prologue()
	      ../../gcc/gcc/config/m32c/prologue.md:26
	0x1058f55 target_gen_prologue
	      ../../gcc/gcc/config/m32c/blkmov.md:359
	0x9fe957 make_prologue_seq
	      ../../gcc/gcc/function.cc:5836
	0x9feb03 thread_prologue_and_epilogue_insns()
	      ../../gcc/gcc/function.cc:6068
	0x9ff262 rest_of_handle_thread_prologue_and_epilogue
	      ../../gcc/gcc/function.cc:6564
	0x9ff262 execute
	      ../../gcc/gcc/function.cc:6647
	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.

 --target=epiphany-elf
 --target=epiphany-elf --with-stack-offset=16
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	/bin/bash ../../gcc/gcc/m2/tools-src/makeSystem -fpim \
	             ../../gcc/gcc/m2/gm2-libs/SYSTEM.def \
	             ../../gcc/gcc/m2/gm2-libs/SYSTEM.mod \
	             -I../../gcc/gcc/m2/gm2-libs \
	             "/var/lib/laminar/run/gcc-epiphany-elfOPT-with-stack-offset=16/22/toolchain-build/./gcc/gm2 -B/var/lib/laminar/run/gcc-epiphany-elfOPT-with-stack-offset=16/22/toolchain-build/./gcc/ " /var/lib/laminar/run/gcc-epiphany-elfOPT-with-stack-offset=16/22/toolchain-build/gcc/m2/gm2-libs/SYSTEM.def
	../../gcc/gcc/m2/gm2-libs/SYSTEM.mod: In function 'ShiftVal':
	../../gcc/gcc/m2/gm2-libs/SYSTEM.mod:89:1: error: unrecognizable insn:
	   89 | END ShiftVal ;
	      | ^~~
	(insn 400 342 343 7 (parallel [
	            (set (mem/c:CC (plus:SI (reg/f:SI 11 fp)
	                        (const_int 92 [0x5c])) [7 %sfp+-12 S4 A32])
	                (reg:CC 18 r18))
	            (use (const_int -4337 [0xffffffffffffef0f]))
	            (clobber (scratch:SI))
	        ]) "../../gcc/gcc/m2/gm2-libs/SYSTEM.mod":80:32 discrim 1 -1
	     (nil))
	during RTL pass: reload
	../../gcc/gcc/m2/gm2-libs/SYSTEM.mod:89:1: internal compiler error: in extract_insn, at recog.cc:2791
	0x63eb16 _fatal_insn(char const*, rtx_def const*, char const*, int, char const*)
	      ../../gcc/gcc/rtl-error.cc:108
	0x63eb32 _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
	      ../../gcc/gcc/rtl-error.cc:116
	0x63d5e3 extract_insn(rtx_insn*)
	      ../../gcc/gcc/recog.cc:2791
	0xca2664 extract_insn_cached(rtx_insn*)
	      ../../gcc/gcc/recog.cc:2680
	0x9bbeb6 cleanup_subreg_operands(rtx_insn*)
	      ../../gcc/gcc/final.cc:3054
	0xccd9a2 reload(rtx_insn*, int)
	      ../../gcc/gcc/reload1.cc:1232
	0xb52a84 do_reload
	      ../../gcc/gcc/ira.cc:5953
	0xb52a84 execute
	      ../../gcc/gcc/ira.cc:6127
	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.

 --target=arm-symbianelf
~~~~~~~~~~~~~~~~~~~~~~~~~
	/bin/bash ../../gcc/gcc/m2/tools-src/makeSystem -fpim \
	             ../../gcc/gcc/m2/gm2-libs/SYSTEM.def \
	             ../../gcc/gcc/m2/gm2-libs/SYSTEM.mod \
	             -I../../gcc/gcc/m2/gm2-libs \
	             "/var/lib/laminar/run/gcc-arm-symbianelf/22/toolchain-build/./gcc/gm2 -B/var/lib/laminar/run/gcc-arm-symbianelf/22/toolchain-build/./gcc/ " /var/lib/laminar/run/gcc-arm-symbianelf/22/toolchain-build/gcc/m2/gm2-libs/SYSTEM.def
	cc1gm2: warning: command-line option '-fno-builtin' is valid for C/C++/D/ObjC/ObjC++ but not for Modula-2
	cc1gm2: warning: command-line option '-fno-short-enums' is valid for Ada/AdaSCIL/AdaWhy/C/C++/Fortran/LTO/ObjC/ObjC++ but not for Modula-2
	cc1gm2: warning: command-line option '-fshort-wchar' is valid for C/C++/LTO/ObjC/ObjC++ but not for Modula-2
	/var/lib/laminar/run/gcc-arm-symbianelf/22/toolchain-build/./gcc/as: 114: exec: -march=armv5t: not found
	cc1gm2: warning: command-line option '-fno-builtin' is valid for C/C++/D/ObjC/ObjC++ but not for Modula-2
	cc1gm2: warning: command-line option '-fno-short-enums' is valid for Ada/AdaSCIL/AdaWhy/C/C++/Fortran/LTO/ObjC/ObjC++ but not for Modula-2
	cc1gm2: warning: command-line option '-fshort-wchar' is valid for C/C++/LTO/ObjC/ObjC++ but not for Modula-2

 --target=bfin-openbsd
~~~~~~~~~~~~~~~~~~~~~~~
	/bin/bash ../../gcc/gcc/m2/tools-src/makeSystem -fpim \
	             ../../gcc/gcc/m2/gm2-libs/SYSTEM.def \
	             ../../gcc/gcc/m2/gm2-libs/SYSTEM.mod \
	             -I../../gcc/gcc/m2/gm2-libs \
	             "/var/lib/laminar/run/gcc-bfin-openbsd/22/toolchain-build/./gcc/gm2 -B/var/lib/laminar/run/gcc-bfin-openbsd/22/toolchain-build/./gcc/ " /var/lib/laminar/run/gcc-bfin-openbsd/22/toolchain-build/gcc/m2/gm2-libs/SYSTEM.def
	/var/lib/laminar/run/gcc-bfin-openbsd/22/toolchain-build/./gcc/as: 114: exec: -o: not found




 Rust related issues
=====================

 --target=msp430-elfbare
~~~~~~~~~~~~~~~~~~~~~~~~~
	/var/lib/laminar/run/gcc-msp430-elfbare/24/toolchain-build/./gcc/xgcc -B/var/lib/laminar/run/gcc-msp430-elfbare/24/toolchain-build/./gcc/  -xrust -frust-incomplete-and-experimental-compiler-do-not-use -nostdinc /dev/null -S -o /dev/null -fself-test=../../gcc/gcc/testsuite/selftests
	<built-in>: internal compiler error: Segmentation fault
	0xf2efbf crash_signal
	      ../../gcc/gcc/toplev.cc:314
	0x120c8c7 build_function_type(tree_node*, tree_node*, bool)
	      ../../gcc/gcc/tree.cc:7360
	0x120cc20 build_function_type_list(tree_node*, ...)
	      ../../gcc/gcc/tree.cc:7442
	0x120d16b build_common_builtin_nodes()
	      ../../gcc/gcc/tree.cc:9883
	0x8449b4 grs_langhook_init
	      ../../gcc/gcc/rust/rust-lang.cc:132
	0x8427b2 lang_dependent_init
	      ../../gcc/gcc/toplev.cc:1815
	0x8427b2 do_compile
	      ../../gcc/gcc/toplev.cc:2110
	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[1]: *** [../../gcc/gcc/rust/Make-lang.in:275: s-selftest-rust] Error 1

-- 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

* Rust: In 'type_for_mode' langhook also consider all 'int_n' modes/types (was: Modula-2 / Rust: Many targets failing)
  2022-12-19 21:23 Modula-2 / Rust: Many targets failing Jan-Benedict Glaw
@ 2023-02-22 11:25 ` Thomas Schwinge
  2023-02-22 11:45   ` Richard Biener
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Thomas Schwinge @ 2023-02-22 11:25 UTC (permalink / raw)
  To: Jan-Benedict Glaw, gcc-patches, Richard Biener
  Cc: Gaius Mulley, arthur.cohen, gcc-rust

[-- Attachment #1: Type: text/plain, Size: 4239 bytes --]

Hi!

Richard, you may remember your words from <https://gcc.gnu.org/PR46805>
"ICE: SIGSEGV in optab_for_tree_code (optabs.c:407) with -O -fno-tree-scev-cprop -ftree-vectorize":

> Ideally we'd never use lang_hooks.types.type_for_mode (or _for_size) in the
> middle-end but had a pure middle-end based implementation.

Is there a canonical PR or other discussion thread for that?

Here's another instance of this issue:

On 2022-12-19T22:23:45+0100, Jan-Benedict Glaw <jbglaw@lug-owl.de> wrote:
> With the recent merges for Modula-2 and Rust, I see a good number of
> targets failing with --enable-languages=all, mostly due to issues with
> the Modula-2 driver.

Thanks for reporting.

>  Modula-2 related issues
> [snipped]

>  Rust related issues
> =====================
>
>  --target=msp430-elfbare
> ~~~~~~~~~~~~~~~~~~~~~~~~~
>       /var/lib/laminar/run/gcc-msp430-elfbare/24/toolchain-build/./gcc/xgcc -B/var/lib/laminar/run/gcc-msp430-elfbare/24/toolchain-build/./gcc/  -xrust -frust-incomplete-and-experimental-compiler-do-not-use -nostdinc /dev/null -S -o /dev/null -fself-test=../../gcc/gcc/testsuite/selftests
>       <built-in>: internal compiler error: Segmentation fault
>       0xf2efbf crash_signal
>             ../../gcc/gcc/toplev.cc:314
>       0x120c8c7 build_function_type(tree_node*, tree_node*, bool)
>             ../../gcc/gcc/tree.cc:7360
>       0x120cc20 build_function_type_list(tree_node*, ...)
>             ../../gcc/gcc/tree.cc:7442
>       0x120d16b build_common_builtin_nodes()
>             ../../gcc/gcc/tree.cc:9883
>       0x8449b4 grs_langhook_init
>             ../../gcc/gcc/rust/rust-lang.cc:132
>       0x8427b2 lang_dependent_init
>             ../../gcc/gcc/toplev.cc:1815
>       0x8427b2 do_compile
>             ../../gcc/gcc/toplev.cc:2110
>       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[1]: *** [../../gcc/gcc/rust/Make-lang.in:275: s-selftest-rust] Error 1

See also <https://github.com/Rust-GCC/gccrs/issues/1713>
"Test failure on msp430-elfbare target".

I confirm with both upstream GCC master branch and GCC/Rust master
branch:

    $ ../source-gcc/configure --target=msp430-elfbare --enable-languages=rust [...]
    $ make all-gcc [...]
    [...]
    [...]/build-gcc/./gcc/xgcc -B[...]/build-gcc/./gcc/  -xc -nostdinc /dev/null -S -o /dev/null -fself-test=../../source-gcc/gcc/testsuite/selftests
    -fself-test: 57323 pass(es) in 0.420000 seconds
    echo timestamp > s-selftest-c
    [...]/build-gcc/./gcc/xgcc -B[...]/build-gcc/./gcc/  -xrust -frust-incomplete-and-experimental-compiler-do-not-use -nostdinc /dev/null -S -o /dev/null -fself-test=../../source-gcc/gcc/testsuite/selftests
    <built-in>: internal compiler error: Segmentation fault
    0xf51b9f crash_signal
            ../../source-gcc/gcc/toplev.cc:314
    0x12e6a3a build_function_type(tree_node*, tree_node*, bool)
            ../../source-gcc/gcc/tree.cc:7447
    0x12e6ee0 build_function_type_list(tree_node*, ...)
            ../../source-gcc/gcc/tree.cc:7529
    0x12e748e build_common_builtin_nodes()
            ../../source-gcc/gcc/tree.cc:9977
    0x7661c4 grs_langhook_init
            ../../source-gcc/gcc/rust/rust-lang.cc:128
    0x762ac9 lang_dependent_init
            ../../source-gcc/gcc/toplev.cc:1815
    0x762ac9 do_compile
            ../../source-gcc/gcc/toplev.cc:2110
    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[1]: *** [s-selftest-rust] Error 1
    [...]

OK to push the attached
"Rust: In 'type_for_mode' langhook also consider all 'int_n' modes/types"?


Grüße
 Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Rust-In-type_for_mode-langhook-also-consider-all-int.patch --]
[-- Type: text/x-diff, Size: 3107 bytes --]

From cae898bef63db18cc40b94ee4d48f85aec258c02 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Wed, 22 Feb 2023 11:42:43 +0100
Subject: [PATCH] Rust: In 'type_for_mode' langhook also consider all 'int_n'
 modes/types

As reported in "Rust related issues" at the end of
<https://inbox.sourceware.org/gcc-patches/20221219212344.ewtuzd2jtztm77x2@lug-owl.de>
"Modula-2 / Rust: Many targets failing",
<https://github.com/Rust-GCC/gccrs/issues/1713>
"Test failure on msp430-elfbare target", for '--target=msp430-elfbar' we ICE:

    <built-in>: internal compiler error: Segmentation fault
    0xf2efbf crash_signal
          ../../gcc/gcc/toplev.cc:314
    0x120c8c7 build_function_type(tree_node*, tree_node*, bool)
          ../../gcc/gcc/tree.cc:7360
    0x120cc20 build_function_type_list(tree_node*, ...)
          ../../gcc/gcc/tree.cc:7442
    0x120d16b build_common_builtin_nodes()
          ../../gcc/gcc/tree.cc:9883
    0x8449b4 grs_langhook_init
          ../../gcc/gcc/rust/rust-lang.cc:132
    [...]

This is due to 'tmp == NULL' for 'gcc/tree.cc:build_common_builtin_nodes':

    tmp = lang_hooks.types.type_for_mode (targetm.eh_return_filter_mode (), 0);

..., were 'targetm.eh_return_filter_mode' (that is,
'gcc/targhooks.cc:default_eh_return_filter_mode',
via calling 'targetm.unwind_word_mode':
'gcc/config/msp430/msp430.cc:msp430_unwind_word_mode') returns 'PSImode',
and 'lang_hooks.types.type_for_mode' (that is,
'gcc/rust/rust-lang.cc:grs_langhook_type_for_mode') returns 'NULL' for
'PSImode'.

As, for example, discussed in <https://gcc.gnu.org/PR46805>
"ICE: SIGSEGV in optab_for_tree_code (optabs.c:407) with -O -fno-tree-scev-cprop -ftree-vectorize",
we have to support "random" modes/types in the 'type_for_mode' langhook.

	gcc/rust/
	* rust-lang.cc (grs_langhook_type_for_mode): Also consider all
	'int_n' modes/types.
---
 gcc/rust/rust-lang.cc | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/gcc/rust/rust-lang.cc b/gcc/rust/rust-lang.cc
index 75f6b4458d7..b4b86236ffc 100644
--- a/gcc/rust/rust-lang.cc
+++ b/gcc/rust/rust-lang.cc
@@ -235,6 +235,21 @@ grs_langhook_type_for_mode (machine_mode mode, int unsignedp)
       if (mode == TYPE_MODE (complex_integer_type_node) && !unsignedp)
 	return complex_integer_type_node;
     }
+
+  /* See (a) <https://github.com/Rust-GCC/gccrs/issues/1713>
+     "Test failure on msp430-elfbare target", and
+     (b) <https://gcc.gnu.org/PR46805>
+     "ICE: SIGSEGV in optab_for_tree_code (optabs.c:407) with -O -fno-tree-scev-cprop -ftree-vectorize"
+     -- we have to support "random" modes/types here.
+     TODO Clean all this up (either locally, or preferably per PR46805:
+     "Ideally we'd never use lang_hooks.types.type_for_mode (or _for_size) in the
+     middle-end but had a pure middle-end based implementation".  */
+  for (size_t i = 0; i < NUM_INT_N_ENTS; i ++)
+    if (int_n_enabled_p[i]
+	&& mode == int_n_data[i].m)
+      return (unsignedp ? int_n_trees[i].unsigned_type
+	      : int_n_trees[i].signed_type);
+
   /* gcc_unreachable */
   return NULL;
 }
-- 
2.25.1


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

* Re: Rust: In 'type_for_mode' langhook also consider all 'int_n' modes/types (was: Modula-2 / Rust: Many targets failing)
  2023-02-22 11:25 ` Rust: In 'type_for_mode' langhook also consider all 'int_n' modes/types (was: Modula-2 / Rust: Many targets failing) Thomas Schwinge
@ 2023-02-22 11:45   ` Richard Biener
  2023-02-22 14:30   ` Arthur Cohen
  2023-02-25 22:20   ` Jan-Benedict Glaw
  2 siblings, 0 replies; 6+ messages in thread
From: Richard Biener @ 2023-02-22 11:45 UTC (permalink / raw)
  To: Thomas Schwinge
  Cc: Jan-Benedict Glaw, gcc-patches, Gaius Mulley, arthur.cohen, gcc-rust

[-- Attachment #1: Type: text/plain, Size: 4626 bytes --]

On Wed, 22 Feb 2023, Thomas Schwinge wrote:

> Hi!
> 
> Richard, you may remember your words from <https://gcc.gnu.org/PR46805>
> "ICE: SIGSEGV in optab_for_tree_code (optabs.c:407) with -O -fno-tree-scev-cprop -ftree-vectorize":
> 
> > Ideally we'd never use lang_hooks.types.type_for_mode (or _for_size) in the
> > middle-end but had a pure middle-end based implementation.
> 
> Is there a canonical PR or other discussion thread for that?

No, not that I'm aware of.

Richard.

> Here's another instance of this issue:
> 
> On 2022-12-19T22:23:45+0100, Jan-Benedict Glaw <jbglaw@lug-owl.de> wrote:
> > With the recent merges for Modula-2 and Rust, I see a good number of
> > targets failing with --enable-languages=all, mostly due to issues with
> > the Modula-2 driver.
> 
> Thanks for reporting.
> 
> >  Modula-2 related issues
> > [snipped]
> 
> >  Rust related issues
> > =====================
> >
> >  --target=msp430-elfbare
> > ~~~~~~~~~~~~~~~~~~~~~~~~~
> >       /var/lib/laminar/run/gcc-msp430-elfbare/24/toolchain-build/./gcc/xgcc -B/var/lib/laminar/run/gcc-msp430-elfbare/24/toolchain-build/./gcc/  -xrust -frust-incomplete-and-experimental-compiler-do-not-use -nostdinc /dev/null -S -o /dev/null -fself-test=../../gcc/gcc/testsuite/selftests
> >       <built-in>: internal compiler error: Segmentation fault
> >       0xf2efbf crash_signal
> >             ../../gcc/gcc/toplev.cc:314
> >       0x120c8c7 build_function_type(tree_node*, tree_node*, bool)
> >             ../../gcc/gcc/tree.cc:7360
> >       0x120cc20 build_function_type_list(tree_node*, ...)
> >             ../../gcc/gcc/tree.cc:7442
> >       0x120d16b build_common_builtin_nodes()
> >             ../../gcc/gcc/tree.cc:9883
> >       0x8449b4 grs_langhook_init
> >             ../../gcc/gcc/rust/rust-lang.cc:132
> >       0x8427b2 lang_dependent_init
> >             ../../gcc/gcc/toplev.cc:1815
> >       0x8427b2 do_compile
> >             ../../gcc/gcc/toplev.cc:2110
> >       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[1]: *** [../../gcc/gcc/rust/Make-lang.in:275: s-selftest-rust] Error 1
> 
> See also <https://github.com/Rust-GCC/gccrs/issues/1713>
> "Test failure on msp430-elfbare target".
> 
> I confirm with both upstream GCC master branch and GCC/Rust master
> branch:
> 
>     $ ../source-gcc/configure --target=msp430-elfbare --enable-languages=rust [...]
>     $ make all-gcc [...]
>     [...]
>     [...]/build-gcc/./gcc/xgcc -B[...]/build-gcc/./gcc/  -xc -nostdinc /dev/null -S -o /dev/null -fself-test=../../source-gcc/gcc/testsuite/selftests
>     -fself-test: 57323 pass(es) in 0.420000 seconds
>     echo timestamp > s-selftest-c
>     [...]/build-gcc/./gcc/xgcc -B[...]/build-gcc/./gcc/  -xrust -frust-incomplete-and-experimental-compiler-do-not-use -nostdinc /dev/null -S -o /dev/null -fself-test=../../source-gcc/gcc/testsuite/selftests
>     <built-in>: internal compiler error: Segmentation fault
>     0xf51b9f crash_signal
>             ../../source-gcc/gcc/toplev.cc:314
>     0x12e6a3a build_function_type(tree_node*, tree_node*, bool)
>             ../../source-gcc/gcc/tree.cc:7447
>     0x12e6ee0 build_function_type_list(tree_node*, ...)
>             ../../source-gcc/gcc/tree.cc:7529
>     0x12e748e build_common_builtin_nodes()
>             ../../source-gcc/gcc/tree.cc:9977
>     0x7661c4 grs_langhook_init
>             ../../source-gcc/gcc/rust/rust-lang.cc:128
>     0x762ac9 lang_dependent_init
>             ../../source-gcc/gcc/toplev.cc:1815
>     0x762ac9 do_compile
>             ../../source-gcc/gcc/toplev.cc:2110
>     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[1]: *** [s-selftest-rust] Error 1
>     [...]
> 
> OK to push the attached
> "Rust: In 'type_for_mode' langhook also consider all 'int_n' modes/types"?
> 
> 
> Grüße
>  Thomas
> 
> 
> -----------------
> Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg,
Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman;
HRB 36809 (AG Nuernberg)

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

* Re: Rust: In 'type_for_mode' langhook also consider all 'int_n' modes/types (was: Modula-2 / Rust: Many targets failing)
  2023-02-22 11:25 ` Rust: In 'type_for_mode' langhook also consider all 'int_n' modes/types (was: Modula-2 / Rust: Many targets failing) Thomas Schwinge
  2023-02-22 11:45   ` Richard Biener
@ 2023-02-22 14:30   ` Arthur Cohen
  2023-02-24  9:12     ` Jan-Benedict Glaw
  2023-02-25 22:20   ` Jan-Benedict Glaw
  2 siblings, 1 reply; 6+ messages in thread
From: Arthur Cohen @ 2023-02-22 14:30 UTC (permalink / raw)
  To: Thomas Schwinge, Jan-Benedict Glaw, gcc-patches, Richard Biener
  Cc: Gaius Mulley, gcc-rust


[-- Attachment #1.1.1: Type: text/plain, Size: 4607 bytes --]

Hi Thomas,

On 2/22/23 12:25, Thomas Schwinge wrote:
> Hi!
> 
> Richard, you may remember your words from <https://gcc.gnu.org/PR46805>
> "ICE: SIGSEGV in optab_for_tree_code (optabs.c:407) with -O -fno-tree-scev-cprop -ftree-vectorize":
> 
>> Ideally we'd never use lang_hooks.types.type_for_mode (or _for_size) in the
>> middle-end but had a pure middle-end based implementation.
> 
> Is there a canonical PR or other discussion thread for that?
> 
> Here's another instance of this issue:
> 
> On 2022-12-19T22:23:45+0100, Jan-Benedict Glaw <jbglaw@lug-owl.de> wrote:
>> With the recent merges for Modula-2 and Rust, I see a good number of
>> targets failing with --enable-languages=all, mostly due to issues with
>> the Modula-2 driver.
> 
> Thanks for reporting.
> 
>>   Modula-2 related issues
>> [snipped]
> 
>>   Rust related issues
>> =====================
>>
>>   --target=msp430-elfbare
>> ~~~~~~~~~~~~~~~~~~~~~~~~~
>>        /var/lib/laminar/run/gcc-msp430-elfbare/24/toolchain-build/./gcc/xgcc -B/var/lib/laminar/run/gcc-msp430-elfbare/24/toolchain-build/./gcc/  -xrust -frust-incomplete-and-experimental-compiler-do-not-use -nostdinc /dev/null -S -o /dev/null -fself-test=../../gcc/gcc/testsuite/selftests
>>        <built-in>: internal compiler error: Segmentation fault
>>        0xf2efbf crash_signal
>>              ../../gcc/gcc/toplev.cc:314
>>        0x120c8c7 build_function_type(tree_node*, tree_node*, bool)
>>              ../../gcc/gcc/tree.cc:7360
>>        0x120cc20 build_function_type_list(tree_node*, ...)
>>              ../../gcc/gcc/tree.cc:7442
>>        0x120d16b build_common_builtin_nodes()
>>              ../../gcc/gcc/tree.cc:9883
>>        0x8449b4 grs_langhook_init
>>              ../../gcc/gcc/rust/rust-lang.cc:132
>>        0x8427b2 lang_dependent_init
>>              ../../gcc/gcc/toplev.cc:1815
>>        0x8427b2 do_compile
>>              ../../gcc/gcc/toplev.cc:2110
>>        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[1]: *** [../../gcc/gcc/rust/Make-lang.in:275: s-selftest-rust] Error 1
> 
> See also <https://github.com/Rust-GCC/gccrs/issues/1713>
> "Test failure on msp430-elfbare target".
> 
> I confirm with both upstream GCC master branch and GCC/Rust master
> branch:
> 
>      $ ../source-gcc/configure --target=msp430-elfbare --enable-languages=rust [...]
>      $ make all-gcc [...]
>      [...]
>      [...]/build-gcc/./gcc/xgcc -B[...]/build-gcc/./gcc/  -xc -nostdinc /dev/null -S -o /dev/null -fself-test=../../source-gcc/gcc/testsuite/selftests
>      -fself-test: 57323 pass(es) in 0.420000 seconds
>      echo timestamp > s-selftest-c
>      [...]/build-gcc/./gcc/xgcc -B[...]/build-gcc/./gcc/  -xrust -frust-incomplete-and-experimental-compiler-do-not-use -nostdinc /dev/null -S -o /dev/null -fself-test=../../source-gcc/gcc/testsuite/selftests
>      <built-in>: internal compiler error: Segmentation fault
>      0xf51b9f crash_signal
>              ../../source-gcc/gcc/toplev.cc:314
>      0x12e6a3a build_function_type(tree_node*, tree_node*, bool)
>              ../../source-gcc/gcc/tree.cc:7447
>      0x12e6ee0 build_function_type_list(tree_node*, ...)
>              ../../source-gcc/gcc/tree.cc:7529
>      0x12e748e build_common_builtin_nodes()
>              ../../source-gcc/gcc/tree.cc:9977
>      0x7661c4 grs_langhook_init
>              ../../source-gcc/gcc/rust/rust-lang.cc:128
>      0x762ac9 lang_dependent_init
>              ../../source-gcc/gcc/toplev.cc:1815
>      0x762ac9 do_compile
>              ../../source-gcc/gcc/toplev.cc:2110
>      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[1]: *** [s-selftest-rust] Error 1
>      [...]
> 
> OK to push the attached
> "Rust: In 'type_for_mode' langhook also consider all 'int_n' modes/types"?|

OK :) patch was tested on x86_64 and builds, bootstraps and pass the 
testsuite.

Kindly,

Arthur

> 
> 
> Grüße
>   Thomas
> 
> 
> -----------------
> Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3195 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: Rust: In 'type_for_mode' langhook also consider all 'int_n' modes/types (was: Modula-2 / Rust: Many targets failing)
  2023-02-22 14:30   ` Arthur Cohen
@ 2023-02-24  9:12     ` Jan-Benedict Glaw
  0 siblings, 0 replies; 6+ messages in thread
From: Jan-Benedict Glaw @ 2023-02-24  9:12 UTC (permalink / raw)
  To: Arthur Cohen
  Cc: Thomas Schwinge, gcc-patches, Richard Biener, Gaius Mulley, gcc-rust

[-- Attachment #1: Type: text/plain, Size: 1720 bytes --]

Hi Thomas / Arthur!

On Wed, 2023-02-22 15:30:37 +0100, Arthur Cohen <arthur.cohen@embecosm.com> wrote:
[..]
> > >   --target=msp430-elfbare
> > > ~~~~~~~~~~~~~~~~~~~~~~~~~
> > >        /var/lib/laminar/run/gcc-msp430-elfbare/24/toolchain-build/./gcc/xgcc -B/var/lib/laminar/run/gcc-msp430-elfbare/24/toolchain-build/./gcc/  -xrust -frust-incomplete-and-experimental-compiler-do-not-use -nostdinc /dev/null -S -o /dev/null -fself-test=../../gcc/gcc/testsuite/selftests
> > >        <built-in>: internal compiler error: Segmentation fault
> > >        0xf2efbf crash_signal
> > >              ../../gcc/gcc/toplev.cc:314
> > >        0x120c8c7 build_function_type(tree_node*, tree_node*, bool)
> > >              ../../gcc/gcc/tree.cc:7360
> > >        0x120cc20 build_function_type_list(tree_node*, ...)
> > >              ../../gcc/gcc/tree.cc:7442
> > >        0x120d16b build_common_builtin_nodes()
> > >              ../../gcc/gcc/tree.cc:9883
> > >        0x8449b4 grs_langhook_init
> > >              ../../gcc/gcc/rust/rust-lang.cc:132
> > >        0x8427b2 lang_dependent_init
> > >              ../../gcc/gcc/toplev.cc:1815
> > >        0x8427b2 do_compile
> > >              ../../gcc/gcc/toplev.cc:2110
> > >        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[1]: *** [../../gcc/gcc/rust/Make-lang.in:275: s-selftest-rust] Error 1

Confirmed successful build #37 for my msp320-elfbare build at
http://toolchain.lug-owl.de/laminar/jobs/gcc-msp430-elfbare

Thanks,
  Jan-Benedict

-- 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

* Re: Rust: In 'type_for_mode' langhook also consider all 'int_n' modes/types (was: Modula-2 / Rust: Many targets failing)
  2023-02-22 11:25 ` Rust: In 'type_for_mode' langhook also consider all 'int_n' modes/types (was: Modula-2 / Rust: Many targets failing) Thomas Schwinge
  2023-02-22 11:45   ` Richard Biener
  2023-02-22 14:30   ` Arthur Cohen
@ 2023-02-25 22:20   ` Jan-Benedict Glaw
  2 siblings, 0 replies; 6+ messages in thread
From: Jan-Benedict Glaw @ 2023-02-25 22:20 UTC (permalink / raw)
  To: Thomas Schwinge
  Cc: gcc-patches, Richard Biener, Gaius Mulley, arthur.cohen, gcc-rust

[-- Attachment #1: Type: text/plain, Size: 1847 bytes --]

Hi Thomas,

On Wed, 2023-02-22 12:25:01 +0100, Thomas Schwinge <thomas@codesourcery.com> wrote:
> On 2022-12-19T22:23:45+0100, Jan-Benedict Glaw <jbglaw@lug-owl.de> wrote:
> >  Rust related issues
> > =====================
> >
> >  --target=msp430-elfbare
> > ~~~~~~~~~~~~~~~~~~~~~~~~~
> >       /var/lib/laminar/run/gcc-msp430-elfbare/24/toolchain-build/./gcc/xgcc -B/var/lib/laminar/run/gcc-msp430-elfbare/24/toolchain-build/./gcc/  -xrust -frust-incomplete-and-experimental-compiler-do-not-use -nostdinc /dev/null -S -o /dev/null -fself-test=../../gcc/gcc/testsuite/selftests
> >       <built-in>: internal compiler error: Segmentation fault
> >       0xf2efbf crash_signal
> >             ../../gcc/gcc/toplev.cc:314
> >       0x120c8c7 build_function_type(tree_node*, tree_node*, bool)
> >             ../../gcc/gcc/tree.cc:7360
> >       0x120cc20 build_function_type_list(tree_node*, ...)
> >             ../../gcc/gcc/tree.cc:7442
> >       0x120d16b build_common_builtin_nodes()
> >             ../../gcc/gcc/tree.cc:9883
> >       0x8449b4 grs_langhook_init
> >             ../../gcc/gcc/rust/rust-lang.cc:132
> >       0x8427b2 lang_dependent_init
> >             ../../gcc/gcc/toplev.cc:1815
> >       0x8427b2 do_compile
> >             ../../gcc/gcc/toplev.cc:2110
> >       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[1]: *** [../../gcc/gcc/rust/Make-lang.in:275: s-selftest-rust] Error 1
> 
> See also <https://github.com/Rust-GCC/gccrs/issues/1713>
> "Test failure on msp430-elfbare target".

Confirm: fixed upstream
(http://toolchain.lug-owl.de/laminar/jobs/gcc-msp430-elf/65)

Thanks,
  Jan-Benedict

-- 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

end of thread, other threads:[~2023-02-25 22:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-19 21:23 Modula-2 / Rust: Many targets failing Jan-Benedict Glaw
2023-02-22 11:25 ` Rust: In 'type_for_mode' langhook also consider all 'int_n' modes/types (was: Modula-2 / Rust: Many targets failing) Thomas Schwinge
2023-02-22 11:45   ` Richard Biener
2023-02-22 14:30   ` Arthur Cohen
2023-02-24  9:12     ` Jan-Benedict Glaw
2023-02-25 22:20   ` Jan-Benedict Glaw

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).