https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122984
--- Comment #2 from Mohammad-Reza Nabipoor <mnabipoor at gnu dot org> ---
Hi.
I came across a possibly similar problem but not on x86-64 (not even with -m32
option).
I attached a sample program which triggers ICE in mark_base_types, at
dwarf2out.cc:31139.
Inside the attached tarball, when I trigger the build using `make arm' or `make
riscv', I get an ICE like this (I built the Arm toolchain for R/M profile):
$ make arm
arm-none-eabi-ga68 -c -mthumb host.a68
arm-none-eabi-ga68 -c -mthumb -O1 -g trigger-ice-on-32bit-arm-riscv.a68
a681: internal compiler error: in mark_base_types, at dwarf2out.cc:31139
0x2021937 internal_error(char const*, ...)
/gnu/gcc-branches/disable-posix-prelude/gcc/diagnostic-global-context.cc:787
0x8de33d fancy_abort(char const*, int, char const*)
/gnu/gcc-branches/disable-posix-prelude/gcc/diagnostics/context.cc:1805
0x6df38c mark_base_types
/gnu/gcc-branches/disable-posix-prelude/gcc/dwarf2out.cc:31139
0xa6c576 resolve_addr
/gnu/gcc-branches/disable-posix-prelude/gcc/dwarf2out.cc:31936
0xa6c3a5 resolve_addr
/gnu/gcc-branches/disable-posix-prelude/gcc/dwarf2out.cc:32110
0xa6c3a5 resolve_addr
/gnu/gcc-branches/disable-posix-prelude/gcc/dwarf2out.cc:32110
0xa92945 dwarf2out_finish
/gnu/gcc-branches/disable-posix-prelude/gcc/dwarf2out.cc:32900
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:11: arm] Error 1
It happens at any optimization level >= 1 and with -g option. In Arm, -mthumb
is important.
And similar for 32-bit RISCV:
$ make riscv
riscv64-elf-ga68 -c -march=rv32im -mabi=ilp32 host.a68
riscv64-elf-ga68 -c -march=rv32im -mabi=ilp32 -O1 -g
trigger-ice-on-32bit-arm-riscv.a68
a681: internal compiler error: in mark_base_types, at dwarf2out.cc:31139
I configured the Arm toolchain like this:
$GCC/configure --target=arm-none-eabi --prefix=$PREFIX
--enable-languages=c,c++,algol68 --disable-shared --disable-threads
--disable-tls --disable-nls --disable-algol68-posix-prelude --with-system-zlib
--with-newlib --enable-multilib --with-multilib-list=rmprofile
--disable-libmudflap --disable-libssp --disable-libquadmath --disable-libgomp
--disable-werror CFLAGS_FOR_TARGET=-Os CXXFLAGS_FOR_TARGET=-Os
I used similar options for riscv64-elf target, too.