Closed xen0n closed 9 months ago
The bug still triggers without LTO. Full relevant log:
0:03.47 /usr/lib/ccache/bin/loongarch64-unknown-linux-gnu-g++ -o SkOpts.o -c -I/tmp/portage/www-client/firefox-119.0.1/work/firefox_build/dist/stl_wrappers -I/tmp/portage/www-client/firefox-119.0.1/work/firefox_build/dist/system_wrappers -include /tmp/portage/www-client/firefox-119.0.1/work/firefox-119.0.1/config/gcc_hidden.h -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -DNDEBUG=1 -DTRIMMED=1 -DMOZ_SKIA -DSKIA_IMPLEMENTATION=1 -DSK_PDF_USE_HARFBUZZ_SUBSETTING=1 -DMOZ_HAS_MOZGLUE -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -DSTATIC_EXPORTABLE_JS_API -I/tmp/portage/www-client/firefox-119.0.1/work/firefox-119.0.1/gfx/skia -I/tmp/portage/www-client/firefox-119.0.1/work/firefox_build/gfx/skia -I/tmp/portage/www-client/firefox-119.0.1/work/firefox-119.0.1/gfx/skia/skia -I/tmp/portage/www-client/firefox-119.0.1/work/firefox-119.0.1/gfx/cairo/cairo/src -I/tmp/portage/www-client/firefox-119.0.1/work/firefox_build/dist/include -I/usr/include/nspr -I/usr/include/nss -I/usr/include/nspr -I/tmp/portage/www-client/firefox-119.0.1/work/firefox_build/dist/include/nss -I/usr/include/pixman-1 -DMOZILLA_CLIENT -include /tmp/portage/www-client/firefox-119.0.1/work/firefox_build/mozilla-config.h -fno-sized-deallocation -fno-aligned-new -march=la464 -mtune=la464 -pipe -fno-exceptions -fPIC -fno-rtti -ffunction-sections -fdata-sections -fno-exceptions -fno-math-errno -pthread -pipe -O2 -fomit-frame-pointer -funwind-tables -Wall -Wempty-body -Wignored-qualifiers -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wno-invalid-offsetof -Wc++2a-compat -Wcomma-subscript -Wvolatile -Wno-error=deprecated -Wno-error=deprecated-enum-enum-conversion -Wduplicated-cond -Wimplicit-fallthrough -Wlogical-op -Wno-error=maybe-uninitialized -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=coverage-mismatch -Wno-error=free-nonheap-object -Wno-multistatement-macros -Wno-error=class-memaccess -Wformat -Wformat-security -Wformat-overflow=2 -Wno-psabi -Wno-error=builtin-macro-redefined -Wno-deprecated-declarations -Wno-overloaded-virtual -Wno-sign-compare -Wno-unreachable-code -Wno-unused-function -Wno-logical-op -Wno-maybe-uninitialized -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/freetype2 -I/usr/include/freetype2 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/blkid -I/usr/lib64/libffi/include -I/usr/include/cairo -I/usr/include/libpng16 -I/usr/include/pixman-1 -I/usr/include/fribidi -pthread -I/usr/include/libmount -fno-strict-aliasing -ffp-contract=off -MD -MP -MF .deps/SkOpts.o.pp -fdiagnostics-color -O3 /tmp/portage/www-client/firefox-119.0.1/work/firefox-119.0.1/gfx/skia/skia/src/core/SkOpts.cpp
[snip]
0:20.00 In file included from /tmp/portage/www-client/firefox-119.0.1/work/firefox-119.0.1/gfx/skia/skia/src/core/SkOpts.cpp:46: 0:20.00 /tmp/portage/www-client/firefox-119.0.1/work/firefox-119.0.1/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h: In function 'void portable::mix_4_ints(Params*, SkRasterPipelineStage*, F, F, F, F)': 0:20.00 /tmp/portage/www-client/firefox-119.0.1/work/firefox-119.0.1/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h:1239:9: error: unrecognizable insn: 0:20.00 1239 | } \
0:20.00 | ^
0:20.00 /tmp/portage/www-client/firefox-119.0.1/work/firefox-119.0.1/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h:1266:5: note: in expansion of macro 'DECLARE_STAGE'
0:20.00 1266 | DECLARE_STAGE(name, arg, void, ++program, /*no offset*/, JUMPER_MUSTTAIL)
0:20.00 | ^~~~~~~~~~~~~
0:20.00 /tmp/portage/www-client/firefox-119.0.1/work/firefox-119.0.1/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h:4111:5: note: in expansion of macro 'STAGE_TAIL'
0:20.01 4111 | STAGE_TAIL(name##_4_ints, I32* p) { apply_adjacent_ternary<I32, &name##_fn>(p, p+4, p+8); } \
0:20.01 | ^~~~~~~~~~
0:20.01 /tmp/portage/www-client/firefox-119.0.1/work/firefox-119.0.1/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h:4118:1: note: in expansion of macro 'DECLARE_TERNARY_INT'
0:20.01 4118 | DECLARE_TERNARY_INT(mix)
0:20.01 | ^~~~~~~~~~~~~~~~~~~
0:20.01 (insn 19 18 20 2 (set (reg:V4SI 104) 0:20.01 (subreg:V4SI (subreg:V4SF (reg:V4SI 98 [ vect__12.16351 ]) 0) 0)) -1
0:20.01 (nil))
0:20.01 during RTL pass: vregs
0:20.01 /tmp/portage/www-client/firefox-119.0.1/work/firefox-119.0.1/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h:1239:9: internal compiler error: in extract_insn, at recog.cc:2804
0:20.01 1239 | } \
0:20.01 | ^
0:20.01 /tmp/portage/www-client/firefox-119.0.1/work/firefox-119.0.1/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h:1266:5: note: in expansion of macro 'DECLARE_STAGE'
0:20.01 1266 | DECLARE_STAGE(name, arg, void, ++program, /*no offset*/, JUMPER_MUSTTAIL)
0:20.01 | ^~~~~~~~~~~~~
0:20.02 /tmp/portage/www-client/firefox-119.0.1/work/firefox-119.0.1/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h:4111:5: note: in expansion of macro 'STAGE_TAIL'
0:20.02 4111 | STAGE_TAIL(name##_4_ints, I32* p) { apply_adjacent_ternary<I32, &name##_fn>(p, p+4, p+8); } \
0:20.02 | ^~~~~~~~~~
0:20.02 /tmp/portage/www-client/firefox-119.0.1/work/firefox-119.0.1/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h:4118:1: note: in expansion of macro 'DECLARE_TERNARY_INT'
0:20.02 4118 | DECLARE_TERNARY_INT(mix)
0:20.02 | ^~~~~~~~~~~~~~~~~~~
0:20.02 0x55555900f003 internal_error(char const*, ...)
0:20.02 ???:0
0:20.02 0x5555572ca9db fancy_abort(char const*, int, char const*)
0:20.02 ???:0
0:20.02 0x5555572af4ab _fatal_insn(char const*, rtx_def const*, char const*, int, char const*)
0:20.02 ???:0
0:20.02 0x5555572af4df _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
0:20.03 ???:0
0:20.03 0x555557ef9277 extract_insn(rtx_insn*)
0:20.03 ???:0
0:20.03 Please submit a full bug report, with preprocessed source (by using -freport-bug).
0:20.03 Please include the complete backtrace with any bug report.
0:20.03 See <https://bugs.gentoo.org/> for instructions.
0:20.03 gmake[4]: *** [/tmp/portage/www-client/firefox-119.0.1/work/firefox-119.0.1/config/rules.mk:661: SkOpts.o] Error 1
I'm working on minimizing a reproducer.
Minified reproducer translated to C:
// loongarch64-unknown-linux-gnu-gcc -O2 -march=la464 -S -o /dev/null ./x.c
void *memcpy(void *, const void *, unsigned long);
int foo, bar;
float baz, res, a;
void apply_adjacent_ternary(float *dst, float *src0) {
do {
memcpy(&res, &src0, sizeof(res));
*dst = foo ? baz : res;
dst++;
} while (dst != src0);
}
void xx(void) { apply_adjacent_ternary(&a, &a); }
The &a, &a
and memcpy
parts are crucial.
Filed upstream bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112476.
Upstream bug is fixed, closing for now. I'd simply wait until the next snapshot bump.
Build log excerpt
System info
`emerge --info` output
``` Portage 3.0.55 (python 3.12.0-final-0, default/linux/loong/22.0/la64v100/lp64d/desktop/gnome/systemd/merged-usr, gcc-14, glibc-2.38-r7, 6.6.0-rc3-next-20230928-gbcdaf018db45 loongarch64) ================================================================= System uname: Linux-6.6.0-rc3-next-20230928-gbcdaf018db45-loongarch64-with-glibc2.38 KiB Mem: 33222960 total, 12422368 free KiB Swap: 33554416 total, 32295920 free Timestamp of repository gentoo: Fri, 10 Nov 2023 04:15:01 +0000 Head commit of repository gentoo: dd1ba8ad190f7176aa6840325cbde63535383987 Timestamp of repository gentoo-zh: Fri, 10 Nov 2023 01:16:52 +0000 Head commit of repository gentoo-zh: 66fa462a96f67201941f87865c60d2c02e9a4b28 Timestamp of repository loongson: Thu, 09 Nov 2023 19:46:53 +0000 Head commit of repository loongson: 541f5368e57d3c9f28ec4f7c0c2a2445e419b0da sh bash 5.2_p15-r7 ld GNU ld (Gentoo 9999 p1) 2.41.50.20231107 ccache version 4.8.3 [disabled] app-misc/pax-utils: 1.3.7::gentoo app-shells/bash: 5.2_p15-r7::gentoo dev-lang/perl: 5.38.0-r1::gentoo dev-lang/python: 3.11.6::gentoo, 3.12.0_p1::gentoo dev-lang/rust-bin: 1.73.0::gentoo dev-util/ccache: 4.8.3::gentoo dev-util/cmake: 3.27.7::gentoo dev-util/meson: 1.2.3::gentoo sys-apps/baselayout: 2.14::gentoo sys-apps/sandbox: 2.38::gentoo sys-apps/systemd: 254.5::gentoo sys-devel/autoconf: 2.13-r8::gentoo, 2.71-r7::gentoo sys-devel/automake: 1.16.5-r1::gentoo sys-devel/binutils: 2.41-r2::gentoo, 9999::gentoo sys-devel/binutils-config: 5.5::gentoo sys-devel/clang: 16.0.6::gentoo, 17.0.4::gentoo sys-devel/gcc: 14.0.0_pre20231105::gentoo sys-devel/gcc-config: 2.11::gentoo sys-devel/libtool: 2.4.7-r1::gentoo sys-devel/lld: 16.0.6-r1::loongson, 17.0.4::gentoo sys-devel/llvm: 16.0.6::gentoo, 17.0.4::gentoo sys-devel/make: 4.4.1-r1::gentoo sys-kernel/linux-headers: 6.6::gentoo (virtual/os-headers) sys-libs/glibc: 2.38-r7::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: rsync sync-uri: rsync://rsync.asia.gentoo.org/gentoo-portage/ priority: -1000 volatile: False sync-rsync-extra-opts: sync-rsync-verify-max-age: 3 sync-rsync-verify-metamanifest: yes sync-rsync-verify-jobs: 1 gentoo-zh location: /var/db/repos/gentoo-zh sync-type: git sync-uri: https://github.com/gentoo-mirror/gentoo-zh.git masters: gentoo volatile: False loongson location: /var/db/repos/loongson sync-type: git sync-uri: https://github.com/gentoo-mirror/loongson.git masters: gentoo volatile: False ACCEPT_KEYWORDS="loong ~loong" ACCEPT_LICENSE="@FREE" CBUILD="loongarch64-unknown-linux-gnu" CFLAGS="-march=la464 -mtune=la464 -pipe -O2" CHOST="loongarch64-unknown-linux-gnu" CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php8.2/ext-active/ /etc/php/cgi-php8.2/ext-active/ /etc/php/cli-php8.2/ext-active/ /etc/php/fpm-php8.2/ext-active/ /etc/php/phpdbg-php8.2/ext-active/ /etc/revdep-rebuild /etc/sandbox.d" CXXFLAGS="-march=la464 -mtune=la464 -pipe -O2" 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="-march=la464 -mtune=la464 -pipe -O2" 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 strict-keepdir unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync warn-on-large-env xattr" FFLAGS="-march=la464 -mtune=la464 -pipe -O2" GENTOO_MIRRORS="https://mirrors.tuna.tsinghua.edu.cn/gentoo/" LANG="en_US.utf8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" LEX="flex" MAKEOPTS="-j8 -l16" 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="/tmp" SHELL="/bin/zsh" USE="X a52 aac acl acpi alsa apng avif bluetooth branding brotli bzip2 cairo cdda cdr cjk cli colord crypt cups dbus dri drm dts dvd dvdr eds encode evo exif flac flatpak fortran gdbm gif gnome gnome-keyring gnome-online-accounts gnome-shell gpm gstreamer gtk gui heif ibus iconv icu idn introspection io-uring ipv6 jack jpeg jpeg2k jpegxl jxl keyring lcms libnotify loong lz4 lzma mad mng mp3 mp4 mpeg nautilus ncurses nls nptl ogg opengl openmp osmesa pam pango pcre pdf png policykit ppds pulseaudio python qt5 readline sdl seccomp smartcard sound spell ssl startup-notification svg systemd test-rust tiff tracker truetype udev udisks unicode upower usb v4l vaapi vorbis vulkan wayland webm webp wxwidgets x264 xattr xcb xft xinerama xml xmp xv xvid zlib zstd" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache 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 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en en-GB en-US eo ga ja ko ru zh-CN zh-TW" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" 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 python3_12" RUBY_TARGETS="ruby31" VIDEO_CARDS="amdgpu radeon radeonsi" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat 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, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS ```