Bug 1912726

Summary: GCC11: internal compiler error: in emit_move_insn when compiling jpeg-xl
Product: [Fedora] Fedora Reporter: Robert-André Mauchin 🐧 <eclipseo>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 34CC: aoliva, dmalcolm, fweimer, jakub, jwakely, law, mpolacek, msebor, nickc, sipoyare
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-04-09 00:01:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1922638    

Description Robert-André Mauchin 🐧 2021-01-05 10:58:02 UTC
When building jpeg-xl (https://gitlab.com/wg1/jpeg-xl/), I am encountering the following ICE on Fedora Rawhide with GCC 11:

*** WARNING *** there are active plugins, do not report this as a bug unless you can reproduce it without enabling any plugins.
Event                            | Plugins
PLUGIN_FINISH_UNIT               | annobin: Generate final annotations
PLUGIN_START_UNIT                | annobin: Generate global annotations
PLUGIN_ALL_PASSES_START          | annobin: Generate per-function annotations
PLUGIN_ALL_PASSES_END            | annobin: Register per-function end symbols
during RTL pass: expand
In file included from /usr/lib/gcc/x86_64-redhat-linux/11/include/immintrin.h:47,
                 from /usr/include/hwy/ops/x86_256-inl.h:22,
                 from /usr/include/hwy/highway.h:231,
                 from /builddir/build/BUILD/jpeg-xl-v0.2-31c71b0f61123a40789b0b8f54feb70e5995420e/lib/jxl/entropy_coder.cc:27,
                 from /usr/include/hwy/foreach_target.h:91,
                 from /builddir/build/BUILD/jpeg-xl-v0.2-31c71b0f61123a40789b0b8f54feb70e5995420e/lib/jxl/entropy_coder.cc:26:
/usr/lib/gcc/x86_64-redhat-linux/11/include/avx2intrin.h: In function 'jxl::N_AVX3::NumNonZeroExceptLLF(unsigned long, unsigned long, jxl::AcStrategy, unsigned long, unsigned long, float const*, unsigned long, int*)':
/usr/lib/gcc/x86_64-redhat-linux/11/include/avx2intrin.h:121:33: internal compiler error: in emit_move_insn, at expr.c:3819
  121 |   return (__m256i) ((__v8su)__A + (__v8su)__B);
      |                    ~~~~~~~~~~~~~^~~~~~~~~~~~~~
0x15f8bc9 diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char const*, __va_list_tag (*) [1], diagnostic_t)
	???:0
0xfc2e35 internal_error(char const*, ...)
	???:0
0xfc2e71 fancy_abort(char const*, int, char const*)
	???:0
0x7ba045 emit_move_insn(rtx_def*, rtx_def*) [clone .cold]
	???:0
0xad9b5f ix86_expand_int_vec_cmp(rtx_def**)
	???:0
0xd808c1 gen_vec_cmpv8siv8si(rtx_def*, rtx_def*, rtx_def*, rtx_def*)
	???:0
0x14d8389 maybe_expand_insn(insn_code, unsigned int, expand_operand*)
	???:0
0x14d9229 expand_insn(insn_code, unsigned int, expand_operand*)
	???:0
0x8a3b21 expand_vec_cmp_expr(tree_node*, tree_node*, rtx_def*)
	???:0
0x7c259c do_store_flag(separate_ops*, rtx_def*, machine_mode) [clone .cold]
	???:0
0x113ecb6 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode, expand_modifier)
	???:0
0x113c6da expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool)
	???:0
0x113c930 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool)
	???:0
0x113c400 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool)
	???:0
0x113c930 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool)
	???:0
0x113c400 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool)
	???:0
0x114061a expand_operands(tree_node*, tree_node*, rtx_def*, rtx_def**, rtx_def**, expand_modifier)
	???:0
0x113ef03 expand_expr_real_2(separate_ops*, rtx_def*, machine_mode, expand_modifier)
	???:0
0x10dfd26 expand_gimple_stmt(gimple*)
	???:0
0x10dc17b (anonymous namespace)::pass_expand::execute(function*)
	???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://bugzilla.redhat.com/bugzilla> for instructions.

Full log: https://copr.fedorainfracloud.org/coprs/eclipseo/jpeg-xl/build/1859311/

The project builds fine with GCC 10.2.1 and Clang.

Please instruct on how to get the backtrace and which preprocessed source you need.

Comment 1 Robert-André Mauchin 🐧 2021-01-05 11:02:11 UTC
Tge specific instruction that fails:

cd /builddir/build/BUILD/jpeg-xl-v0.2-31c71b0f61123a40789b0b8f54feb70e5995420e/x86_64-redhat-linux-gnu/lib && /usr/lib64/ccache/g++ -DJPEGXL_MAJOR_VERSION=0 -DJPEGXL_MINOR_VERSION=2 -DJPEGXL_PATCH_VERSION=0 -DJXL_INTERNAL_LIBRARY_BUILD -D__DATE__=\"redacted\" -D__TIMESTAMP__=\"redacted\" -D__TIME__=\"redacted\" -I/builddir/build/BUILD/jpeg-xl-v0.2-31c71b0f61123a40789b0b8f54feb70e5995420e -I/builddir/build/BUILD/jpeg-xl-v0.2-31c71b0f61123a40789b0b8f54feb70e5995420e/lib/include -I/builddir/build/BUILD/jpeg-xl-v0.2-31c71b0f61123a40789b0b8f54feb70e5995420e/third_party/skcms -I/builddir/build/BUILD/jpeg-xl-v0.2-31c71b0f61123a40789b0b8f54feb70e5995420e/x86_64-redhat-linux-gnu/lib/include -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -funwind-tables -fno-omit-frame-pointer -DNDEBUG -O2 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wno-builtin-macro-redefined -Wall -fmerge-all-constants -fno-builtin-fwrite -fno-builtin-fread -Wextra -Wc++11-compat -Warray-bounds -Wformat-security -Wimplicit-fallthrough -Wno-register -Wno-unused-function -Wno-unused-parameter -Wnon-virtual-dtor -Woverloaded-virtual -Wvla -fno-signed-char -fsized-deallocation -fno-exceptions -fmath-errno -DJPEGXL_ENABLE_SKCMS=1 -std=c++11 -o CMakeFiles/jxl-obj.dir/jxl/entropy_coder.cc.o -c /builddir/build/BUILD/jpeg-xl-v0.2-31c71b0f61123a40789b0b8f54feb70e5995420e/lib/jxl/entropy_coder.cc

Comment 2 Jakub Jelinek 2021-01-05 11:08:01 UTC
Can you add -save-temps option to the above ones and attach entrypy_coder.ii it creates?  Thanks.

Comment 3 Robert-André Mauchin 🐧 2021-01-05 11:17:50 UTC
Here it is:

https://eclipseo.fedorapeople.org/entropy_coder.cc.ii

And if you also need it: https://eclipseo.fedorapeople.org/entropy_coder.cc.s

Comment 4 Ben Cotton 2021-02-09 15:36:32 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.

Comment 5 Robert-André Mauchin 🐧 2021-04-09 00:01:10 UTC
It seems fixed in Rawhide.