foss-for-synopsys-dwc-arc-processors / toolchain

Repository containing releases of prebuilt GNU toolchains for DesignWare ARC Processors from Synopsys (available from "releases" link below).
http://www.synopsys.com/IP/ProcessorIP/ARCProcessors/Pages/default.aspx
GNU General Public License v3.0
92 stars 48 forks source link

Error building arc64-unknown-elf from arc64 branch (daily build) #632

Open yaroslavsadin opened 4 months ago

yaroslavsadin commented 4 months ago

Several files cause compiler errors when building on branch arc64 (aka dev branch) which is used for daily builds.

$ ./crosstool-ng/.build/arc64-snps-elf/buildtools/bin/arc64-snps-elf-cc -B/home/arcoss/crosstool-ng/.build/arc64-snps-elf/build/build-libc/arc64-snps-elf/newlib/ -isystem /home/arcoss/crosstool-ng/.build/arc64-snps-elf/build/build-libc/arc64-snps-elf/newlib/targ-include -isystem /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/newlib/libc/include -B/home/arcoss/crosstool-ng/.build/arc64-snps-elf/build/build-libc/arc64-snps-elf/libgloss/arc64 -L/home/arcoss/crosstool-ng/.build/arc64-snps-elf/build/build-libc/arc64-snps-elf/libgloss/libnosys -L/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/arc64    -DHAVE_CONFIG_H -I. -I/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss  -I/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/arc  -mvolatile-di -g -O2 -ffunction-sections -fdata-sections  -MT arc/arc64_libhl_a-arc-timer.o -MD -MP -MF arc/.deps/arc6$_libhl_a-arc-timer.Tpo -c -o arc/arc64_libhl_a-arc-timer.o `test -f 'arc/arc-timer.c' || echo '/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/'`arc/arc-timer.c
during RTL pass: expand
In file included from /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/arc/arc-timer.c:18:
In function '_arc_timer_present',
    inlined from '_arc_timer_default_present' at /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/arc/arc-timer.c:116:10:
/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/arc/arc-specific.h:26:41: internal compiler error: in DECL_FUNCTION_CODE, at tree.h:4321
   26 |         #define read_aux_reg(r)         __builtin_arc_lr(r)
      |                                         ^~~~~~~~~~~~~~~~~~~
/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/arc/arc-timer.c:42:22: note: in expansion of macro 'read_aux_reg'
   42 |   unsigned int bcr = read_aux_reg (ARC_TIM_BUILD);
      |                      ^~~~~~~~~~~~
0x81e0ef DECL_FUNCTION_CODE(tree_node const*)
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/tree.h:4321
0x81e0ef arc64_expand_builtin
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/config/arc64/arc64.cc:2962
0xacaded expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int)
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/builtins.cc:7769
0xc1405f expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool)
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/expr.cc:12357
0xc1eacf store_expr(tree_node*, rtx_def*, int, bool, bool)
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/expr.cc:6747
0xc1ff2f expand_assignment(tree_node*, tree_node*, bool)
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/expr.cc:6468
0xaef44c expand_call_stmt
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/cfgexpand.cc:2893
0xaef44c expand_gimple_stmt_1
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/cfgexpand.cc:3962
0xaef44c expand_gimple_stmt
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/cfgexpand.cc:4104
0xaf4bce expand_gimple_basic_block
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/cfgexpand.cc:6160
0xaf6cf7 execute
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/cfgexpand.cc:6899
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.
$ ./crosstool-ng/.build/arc64-snps-elf/buildtools/bin/arc64-snps-elf-cc -B/home/arcoss/crosstool-ng/.build/arc64-snps-elf/build/build-libc/arc64-snps-elf/newlib/ -isystem /home/arcoss/crosstool-ng/.build/arc64-snps-elf/build/build-libc/arc64-snps-elf/newlib/targ-include -isystem /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/newlib/libc/include -B/home/arcoss/crosstool-ng/.build/arc64-snps-elf/build/build-libc/arc64-snps-elf/libgloss/arc64 -L/home/arcoss/crosstool-ng/.build/arc64-snps-elf/build/build-libc/arc64-snps-elf/libgloss/libnosys -L/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/arc64    -DHAVE_CONFIG_H -I. -I/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss  -I/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/arc  -mvolatile-di -g -O2 -ffunction-sections -fdata-sections  -MT arc/hl/arc64_libhl_a-hl_write.o -MD -MP -MF arc/hl/.deps/arc64_libhl_a-hl_write.Tpo -c -o arc/hl/arc64_libhl_a-hl_write.o `test -f 'arc/hl/hl_write.c' || echo '/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/'`arc/hl/hl_write.c
during RTL pass: vregs
/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/arc/hl/hl_write.c: In function '_hl_write':
/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/arc/hl/hl_write.c:61:1: internal compiler error: RTL flag check: MEM_VOLATILE_P used with unexpected rtx code 'reg' in recog_34, at config/arc64/arc64.md:1979
   61 | }
      | ^
0x771542 rtl_check_failed_flag(char const*, rtx_def const*, char const*, int, char const*)
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/rtl.cc:853
0x8fb5a5 recog_34
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/config/arc64/arc64.md:1979
0xf9d9e9 recog_memoized(rtx_insn*)
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/recog.h:295
0xf9d9e9 extract_insn(rtx_insn*)
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/recog.cc:2810
0xc8432d instantiate_virtual_regs_in_insn
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/function.cc:1612
0xc8432d instantiate_virtual_regs
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/function.cc:1995
0xc8432d execute
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/function.cc:2042
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.
$ ./crosstool-ng/.build/arc64-snps-elf/buildtools/bin/arc64-snps-elf-cc -B/home/arcoss/crosstool-ng/.build/arc64-snps-elf/build/build-libc/arc64-snps-elf/newlib/ -isystem /home/arcoss/crosstool-ng/.build/arc64-snps-elf/build/build-libc/arc64-snps-elf/newlib/targ-include -isystem /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/newlib/libc/include -B/home/arcoss/crosstool-ng/.build/arc64-snps-elf/build/build-libc/arc64-snps-elf/libgloss/arc64 -L/home/arcoss/crosstool-ng/.build/arc64-snps-elf/build/build-libc/arc64-snps-elf/libgloss/libnosys -L/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/arc64    -DHAVE_CONFIG_H -I. -I/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss  -I/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/arc  -mvolatile-di -g -O2 -ffunction-sections -fdata-sections  -MT arc/hl/arc64_libhl_a-hl_lseek.o -MD -MP -MF arc/hl/.deps/arc64_libhl_a-hl_lseek.Tpo -c -o arc/hl/arc64_libhl_a-hl_lseek.o `test -f 'arc/hl/hl_lseek.c' || echo '/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/'`arc/hl/hl_lseek.c
during RTL pass: vregs
/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/arc/hl/hl_lseek.c: In function '_lseek':
/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/arc/hl/hl_lseek.c:68:1: internal compiler error: RTL flag check: MEM_VOLATILE_P used with unexpected rtx code 'reg' in recog_34, at config/arc64/arc64.md:1979
   68 | }
      | ^
0x771542 rtl_check_failed_flag(char const*, rtx_def const*, char const*, int, char const*)
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/rtl.cc:853
0x8fb5a5 recog_34
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/config/arc64/arc64.md:1979
0xf9d9e9 recog_memoized(rtx_insn*)
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/recog.h:295
0xf9d9e9 extract_insn(rtx_insn*)
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/recog.cc:2810
0xc8432d instantiate_virtual_regs_in_insn
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/function.cc:1612
0xc8432d instantiate_virtual_regs
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/function.cc:1995
0xc8432d execute
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/function.cc:2042
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.
$ ./crosstool-ng/.build/arc64-snps-elf/buildtools/bin/arc64-snps-elf-cc -B/home/arcoss/crosstool-ng/.build/arc64-snps-elf/build/build-libc/arc64-snps-elf/newlib/ -isystem /home/arcoss/crosstool-ng/.build/arc64-snps-elf/build/build-libc/arc64-snps-elf/newlib/targ-include -isystem /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/newlib/libc/include -B/home/arcoss/crosstool-ng/.build/arc64-snps-elf/build/build-libc/arc64-snps-elf/libgloss/arc64 -L/home/arcoss/crosstool-ng/.build/arc64-snps-elf/build/build-libc/arc64-snps-elf/libgloss/libnosys -L/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/arc64    -DHAVE_CONFIG_H -I. -I/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss  -I/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/arc  -mvolatile-di -g -O2 -ffunction-sections -fdata-sections  -MT arc/hl/arc64_libhl_a-hl_api.o -MD -MP -MF arc/hl/.deps/arc64_libhl_a-hl_api.Tpo -c -o arc/hl/arc64_libhl_a-hl_api.o `test -f 'arc/hl/hl_api.c' || echo '/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/'`arc/hl/hl_api.c
during RTL pass: vregs
/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/arc/hl/hl_api.c: In function '_hl_pack_ptr':
/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/libgloss/arc/hl/hl_api.c:222:1: internal compiler error: RTL flag check: MEM_VOLATILE_P used with unexpected rtx code 'reg' in recog_34, at config/arc64/arc64.md:1979
  222 | }
      | ^
0x771542 rtl_check_failed_flag(char const*, rtx_def const*, char const*, int, char const*)
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/rtl.cc:853
0x8fb5a5 recog_34
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/config/arc64/arc64.md:1979
0xf9d9e9 recog_memoized(rtx_insn*)
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/recog.h:295
0xf9d9e9 extract_insn(rtx_insn*)
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/recog.cc:2810
0xc8432d instantiate_virtual_regs_in_insn
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/function.cc:1612
0xc8432d instantiate_virtual_regs
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/function.cc:1995
0xc8432d execute
        /home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/gcc/function.cc:2042
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.
yaroslavsadin commented 4 months ago

Please see configure lines below.

[DEBUG]    ==> Executing:  CC_FOR_BUILD='x86_64-build_pc-linux-gnu-gcc'
 CFLAGS_FOR_BUILD='-O2 -g -I/home/arcoss/crosstool-ng/.build/arc64-snps-elf/buildtools/include  '
 CXXFLAGS_FOR_BUILD='-O2 -g -I/home/arcoss/crosstool-ng/.build/arc64-snps-elf/buildtools/include   '
 LDFLAGS_FOR_BUILD='-L/home/arcoss/crosstool-ng/.build/arc64-snps-elf/buildtools/lib  '
 CFLAGS='-O2 -g -pipe -I/home/arcoss/crosstool-ng/.build/arc64-snps-elf/buildtools/include  '
 CXXFLAGS='-O2 -g -pipe -I/home/arcoss/crosstool-ng/.build/arc64-snps-elf/buildtools/include   '
 LDFLAGS='-L/home/arcoss/crosstool-ng/.build/arc64-snps-elf/buildtools/lib  '
 '/usr/bin/bash'
 '/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/binutils/configure'
 '--build=x86_64-build_pc-linux-gnu'
 '--host=x86_64-build_pc-linux-gnu'
 '--target=arc64-snps-elf'
 '--prefix=/home/arcoss/crosstool-ng/arc64-unknown-elf'
 '--disable-werror'
 '--enable-ld=yes'
 '--enable-gold=no'
 '--enable-deterministic-archives'
 '--with-pkgversion=ARCv3 elf toolchain - build 6967'
 '--enable-multilib'
 '--disable-sim'
 '--disable-gdb'
 '--disable-nls'
 '--without-zstd'
 '--with-sysroot=/home/arcoss/crosstool-ng/arc64-unknown-elf/arc64-snps-elf'

[DEBUG]    ==> Executing:  CC_FOR_BUILD='x86_64-build_pc-linux-gnu-gcc'
 CFLAGS='-O2 -g -I/home/arcoss/crosstool-ng/.build/arc64-snps-elf/buildtools/include  '
 CFLAGS_FOR_BUILD='-O2 -g -I/home/arcoss/crosstool-ng/.build/arc64-snps-elf/buildtools/include  '
 CXXFLAGS='-O2 -g -I/home/arcoss/crosstool-ng/.build/arc64-snps-elf/buildtools/include   '
 CXXFLAGS_FOR_BUILD='-O2 -g -I/home/arcoss/crosstool-ng/.build/arc64-snps-elf/buildtools/include   '
 LDFLAGS='-L/home/arcoss/crosstool-ng/.build/arc64-snps-elf/buildtools/lib  '
 CFLAGS_FOR_TARGET='-g -O2 -g -O2 -ffunction-sections -fdata-sections -idirafter /home/arcoss/crosstool-ng/arc64-unknown-elf/arc64-snps-elf/include'
 CXXFLAGS_FOR_TARGET='-g -O2 -g -O2 -ffunction-sections -fdata-sections -idirafter /home/arcoss/crosstool-ng/arc64-unknown-elf/arc64-snps-elf/include'
 LDFLAGS_FOR_TARGET=' -static'
 '/usr/bin/bash'
 '/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/gcc/configure'
 '--build=x86_64-build_pc-linux-gnu'
 '--host=x86_64-build_pc-linux-gnu'
 '--target=arc64-snps-elf'
 '--prefix=/home/arcoss/crosstool-ng/.build/arc64-snps-elf/buildtools'
 '--exec_prefix=/home/arcoss/crosstool-ng/.build/arc64-snps-elf/buildtools'
 '--with-local-prefix=/home/arcoss/crosstool-ng/arc64-unknown-elf/arc64-snps-elf'
 '--with-sysroot=/home/arcoss/crosstool-ng/arc64-unknown-elf/arc64-snps-elf'
 '--with-native-system-header-dir=/include'
 '--with-newlib'
 '--enable-threads=no'
 '--disable-shared'
 '--with-pkgversion=ARCv3 elf toolchain - build 6967'
 '--enable-__cxa_atexit'
 '--disable-libgomp'
 '--disable-libmudflap'
 '--disable-libmpx'
 '--disable-libssp'
 '--disable-libquadmath'
 '--disable-libquadmath-support'
 '--disable-libstdcxx-verbose'
 '--disable-libstdcxx'
 '--with-gmp=/home/arcoss/crosstool-ng/.build/arc64-snps-elf/buildtools'
 '--with-mpfr=/home/arcoss/crosstool-ng/.build/arc64-snps-elf/buildtools'
 '--with-mpc=/home/arcoss/crosstool-ng/.build/arc64-snps-elf/buildtools'
 '--with-isl=no'
 '--with-cloog=no'
 '--enable-lto'
 '--disable-nls'
 '--disable-tls'
 '--enable-multiarch'
 '--enable-languages=c'

[DEBUG]    ==> Executing:  CC_FOR_BUILD='x86_64-build_pc-linux-gnu-gcc'
 CFLAGS_FOR_TARGET=' -g -O2 -ffunction-sections -fdata-sections '
 AR_FOR_TARGET='/home/arcoss/crosstool-ng/.build/arc64-snps-elf/buildtools/bin/arc64-snps-elf-gcc-ar'
 RANLIB_FOR_TARGET='/home/arcoss/crosstool-ng/.build/arc64-snps-elf/buildtools/bin/arc64-snps-elf-gcc-ranlib'
 '/usr/bin/bash'
 '/home/arcoss/crosstool-ng/.build/arc64-snps-elf/src/newlib/configure'
 '--host=x86_64-build_pc-linux-gnu'
 '--target=arc64-snps-elf'
 '--prefix=/home/arcoss/crosstool-ng/arc64-unknown-elf'
 '--enable-newlib-io-float'
 '--disable-newlib-io-long-double'
 '--enable-newlib-supplied-syscalls'
 '--disable-newlib-io-pos-args'
 '--disable-newlib-io-c99-formats'
 '--enable-newlib-io-long-long'
 '--disable-newlib-register-fini'
 '--disable-newlib-nano-malloc'
 '--disable-newlib-nano-formatted-io'
 '--enable-newlib-atexit-dynamic-alloc'
 '--enable-newlib-global-atexit'
 '--disable-lite-exit'
 '--disable-newlib-reent-small'
 '--enable-newlib-multithread'
 '--disable-newlib-retargetable-locking'
 '--enable-newlib-wide-orient'
 '--enable-newlib-fseek-optimization'
 '--enable-newlib-fvwrite-in-streamio'
 '--enable-newlib-unbuf-stream-opt'
 '--disable-target-optspace'
shahab-vahedi commented 4 months ago

It seems there are 2 discern issues among these 4 failures.

during RTL pass: expand: arc-timer.c during RTL pass: vregs: hl_{write,lseek,api}.c

@yaroslavsadin could you provide the preprocessed versions of these files (obtained by -save-temps)?

yaroslavsadin commented 4 months ago

@shahab-vahedi preprocessed files attached. preprocessed.zip

shahab-vahedi commented 4 months ago

On my end, I cannot reproduce this with a multilib hs6x toolcahin built with arc-gnu-toolchain.