Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 924315 - sys-devel/gcc-13.2.1_p20240113-r1: ICE with -mcpu=thead-c906 when building sys-libs/glibc-2.38-r10
Summary: sys-devel/gcc-13.2.1_p20240113-r1: ICE with -mcpu=thead-c906 when building sy...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: riscv Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-11 21:55 UTC by nop
Modified: 2024-03-24 22:39 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Preprocessed source (ccDRyT6Q.out,867.04 KB, text/x-csrc)
2024-02-11 21:57 UTC, nop
Details
build.log (build.log.gz,51.91 KB, application/x-gzip)
2024-02-11 21:59 UTC, nop
Details

Note You need to log in before you can comment on or make changes to this bug.
Description nop 2024-02-11 21:55:55 UTC
mu-loong /var/tmp/portage/sys-libs/glibc-2.38-r10/work/glibc-2.38/libio # LANG=C riscv64-unknown-linux-gnu-gcc -mabi=lp64d -mcpu=thead-c906 -pipe -ggdb3 -O2 -Wl,-O1 -Wl,--as-needed ../sysdeps/unix/sysv/linux/libc_fatal.c -c -std=gnu11 -fgnu89-inline  -mcpu=thead-c906 -pipe -ggdb3 -O2 -Wall -Wwrite-strings -Wundef -fmerge-all-constants -frounding-math -fstack-protector-strong -fno-common -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wstrict-prototypes -Wold-style-definition -fmath-errno    -fPIC     -ftls-model=initial-exec     -I../include -I/var/tmp/portage/sys-libs/glibc-2.38-r10/work/build-lp64d-riscv64-unknown-linux-gnu-nptl/libio  -I/var/tmp/portage/sys-libs/glibc-2.38-r10/work/build-lp64d-riscv64-unknown-linux-gnu-nptl  -I../sysdeps/unix/sysv/linux/riscv/rv64  -I../sysdeps/unix/sysv/linux/riscv  -I../sysdeps/riscv/nptl  -I../sysdeps/unix/sysv/linux/wordsize-64  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/riscv/rv64/rvd  -I../sysdeps/riscv/rv64/rvf  -I../sysdeps/riscv/rvf  -I../sysdeps/riscv/rvd  -I../sysdeps/riscv/rv64  -I../sysdeps/riscv  -I../sysdeps/ieee754/ldbl-128  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/wordsize-64  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/riscv64-unknown-linux-gnu/13/include -isystem /usr/lib/gcc/riscv64-unknown-linux-gnu/13/include-fixed -isystem /usr/include -D_LIBC_REENTRANT -include /var/tmp/portage/sys-libs/glibc-2.38-r10/work/build-lp64d-riscv64-unknown-linux-gnu-nptl/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h  -DPIC -DSHARED     -DTOP_NAMESPACE=glibc -D_IO_MTSAFE_IO -o /var/tmp/portage/sys-libs/glibc-2.38-r10/work/build-lp64d-riscv64-unknown-linux-gnu-nptl/libio/libc_fatal.os -MD -MP -MF /var/tmp/portage/sys-libs/glibc-2.38-r10/work/build-lp64d-riscv64-unknown-linux-gnu-nptl/libio/libc_fatal.os.dt -MT /var/tmp/portage/sys-libs/glibc-2.38-r10/work/build-lp64d-riscv64-unknown-linux-gnu-nptl/libio/libc_fatal.os -freport-bug
during RTL pass: dwarf2
In file included from ../sysdeps/unix/sysv/linux/libc_fatal.c:36:
../sysdeps/posix/libc_fatal.c: In function '__libc_message':
../sysdeps/posix/libc_fatal.c:151:1: internal compiler error: in dwarf2out_frame_debug_cfa_offset, at dwarf2cfi.cc:1376
  151 | }
      | ^
0x40c46d dwarf2out_frame_debug_cfa_offset
        /usr/src/debug/sys-devel/gcc-13.2.1_p20240113-r1/gcc-13-20240113/gcc/dwarf2cfi.cc:1376
0x40c46d dwarf2out_frame_debug
        /usr/src/debug/sys-devel/gcc-13.2.1_p20240113-r1/gcc-13-20240113/gcc/dwarf2cfi.cc:2285
0x40c46d scan_insn_after
        /usr/src/debug/sys-devel/gcc-13.2.1_p20240113-r1/gcc-13-20240113/gcc/dwarf2cfi.cc:2726
0x40d11b scan_trace
        /usr/src/debug/sys-devel/gcc-13.2.1_p20240113-r1/gcc-13-20240113/gcc/dwarf2cfi.cc:2893
0x40d447 create_cfi_notes
        /usr/src/debug/sys-devel/gcc-13.2.1_p20240113-r1/gcc-13-20240113/gcc/dwarf2cfi.cc:2933
0x40d447 execute_dwarf2_frame
        /usr/src/debug/sys-devel/gcc-13.2.1_p20240113-r1/gcc-13-20240113/gcc/dwarf2cfi.cc:3309
0x40d447 execute
        /usr/src/debug/sys-devel/gcc-13.2.1_p20240113-r1/gcc-13-20240113/gcc/dwarf2cfi.cc:3799
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.

Reproducible: Always

Actual Results:  
Causes dwarf2cfi crash in ../sysdeps/posix/libc_fatal.c: In function '__libc_message':


MilkV Pioneer Board with SOHPON SG2042, 128GB ECC compiling on WD BLACK SN850 NVMe

Portage 3.0.61 (python 3.11.8-final-0, default/linux/riscv/23.0/rv64/lp64d, gcc-13, glibc-2.38-r10, 6.8.0-rc1+ riscv64)
=================================================================
System uname: Linux-6.8.0-rc1+-riscv64-with-glibc2.38
KiB Mem:   127749096 total, 121651392 free
KiB Swap:   16777212 total,  16777212 free
Timestamp of repository gentoo: Sat, 10 Feb 2024 19:30:01 +0000
Head commit of repository gentoo: 2f15099c45624e0622f216546d595467a6392b79
sh bash 5.2_p26
ld GNU ld (Gentoo 2.41 p5) 2.41.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p26::gentoo
dev-build/autoconf:        2.72-r1::gentoo
dev-build/automake:        1.16.5-r2::gentoo
dev-build/cmake:           3.28.3::gentoo
dev-build/libtool:         2.4.7-r2::gentoo
dev-build/make:            4.4.1-r1::gentoo
dev-build/meson:           1.3.1-r1::gentoo
dev-lang/perl:             5.38.2-r1::gentoo
dev-lang/python:           3.11.8::gentoo, 3.12.2::gentoo
dev-lang/rust:             1.75.0::gentoo
sys-apps/baselayout:       2.14-r3::gentoo
sys-apps/openrc:           0.53::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-devel/binutils:        2.41-r5::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/gcc:             13.2.1_p20240113-r1::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-kernel/linux-headers:  6.7::gentoo (virtual/os-headers)
sys-libs/glibc:            2.38-r10::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    volatile: False
    sync-rsync-verify-max-age: 3
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-metamanifest: yes
    sync-rsync-extra-opts:

ACCEPT_KEYWORDS="riscv ~riscv"
ACCEPT_LICENSE="@FREE @FREE @BINARY-REDISTRIBUTABLE"
CBUILD="riscv64-unknown-linux-gnu"
CFLAGS="-O2 -mcpu=thead-c906 -pipe"
CHOST="riscv64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d"
CXXFLAGS="-O2 -mcpu=thead-c906 -pipe"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -mcpu=thead-c906 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -mcpu=thead-c906 -pipe"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="acl bzip2 crypt gdbm iconv ipv6 lzma ncurses nls pam pcre readline riscv seccomp ssl test-rust unicode xattr zlib zstd" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby31" VIDEO_CARDS="fbdev" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, MAKEOPTS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 nop 2024-02-11 21:57:22 UTC
Created attachment 884748 [details]
Preprocessed source
Comment 2 nop 2024-02-11 21:59:29 UTC
Created attachment 884758 [details]
build.log
Comment 3 nop 2024-02-11 22:01:36 UTC
-march=                              rv64imafdc_zicsr_xtheadba_xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadmac_xtheadmemidx_xtheadmempair_xtheadsync

This appears to be the difference between -mcpu=thead-c906 and -mtune=thead-c906 as -mtune works appropriately.

mu-loong ~ # for t in param target optimize optimizer; do cmd="gcc -Q --help=$t"; diff -U0 <(LANG=C $cmd) <(LANG=C $cmd -mcpu=thead-c906); done
--- /dev/fd/63  2024-02-11 15:29:32.153384685 -0600
+++ /dev/fd/62  2024-02-11 15:29:32.153384685 -0600
@@ -4 +4 @@
-  -march=                              rv64imafdc_zicsr_zifencei
+  -march=                              rv64imafdc_zicsr_xtheadba_xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadmac_xtheadmemidx_xtheadmempair_xtheadsync
@@ -9 +9 @@
-  -mcpu=PROCESSOR
+  -mcpu=PROCESSOR                      thead-c906
@@ -29 +29 @@
-  -mstrict-align                       [enabled]
+  -mstrict-align                       [disabled]

mu-loong ~ # for t in param target optimize optimizer; do cmd="gcc -Q --help=$t"; diff -U0 <(LANG=C $cmd) <(LANG=C $cmd -mtune=thead-c906); done
--- /dev/fd/63  2024-02-11 15:31:00.813301648 -0600
+++ /dev/fd/62  2024-02-11 15:31:00.813301648 -0600                                                                                                    @@ -29,2 +29,2 @@
-  -mstrict-align                       [enabled]
-  -mtune=PROCESSOR
+  -mstrict-align                       [disabled]
+  -mtune=PROCESSOR                     thead-c906
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-02-12 08:31:26 UTC
Thanks. Could you try follow https://wiki.gentoo.org/wiki/Gcc-ICE-reporting-guide?
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-02-12 08:32:22 UTC
(In reply to Sam James from comment #4)
> Thanks. Could you try follow
> https://wiki.gentoo.org/wiki/Gcc-ICE-reporting-guide?

sorry, to be specific, I mean, if you're willing:
* cvise it
* report it upstream

If you aren't able to do one or both of those, that's fine, just let us know and one of toolchain@ or riscv@ can handle it. Thanks!
Comment 6 nop 2024-02-13 20:13:05 UTC
I’ll work on cvise and reporting to upstream when I find time. I’ll also join gentoo-riscv on IRC.
Comment 7 nop 2024-02-29 06:21:22 UTC
bug submitted upstream: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114160
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-02-29 06:33:01 UTC
(In reply to nop from comment #7)
> bug submitted upstream: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114160

Thank you!
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-03-24 22:39:55 UTC
commit 6ae7e796ed9e28c65e66ba39b8eeee78cbc92499
Author: Sam James <sam@gentoo.org>
Date:   Sun Mar 24 09:29:45 2024 +0000

    sys-devel/gcc: add 13.2.1_p20240323

    Signed-off-by: Sam James <sam@gentoo.org>

(not yet kw'd)