Bug 2292501

Summary: internal compiler error, zxing-cpp build failed only on s390x with python 3.13 mass rebuild
Product: [Fedora] Fedora Reporter: Felix Wang <topazus>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 42CC: dan, dmalcolm, fweimer, jakub, jlaw, josmyers, jwakely, mcermak, mhroncok, mpolacek, msebor, nickc, nixuser, sipoyare, susi.lehtola
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: gcc-14.1.1-6.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
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: 467765, 2292021, 2292025    
Attachments:
Description Flags
preprocessed sources none

Description Felix Wang 2024-06-15 14:47:46 UTC
zxing-cpp rebuild failed only on s390x with the following error [1],[2]:

```
[ 21%] Building CXX object core/CMakeFiles/ZXing.dir/src/PerspectiveTransform.cpp.o
cd /builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/redhat-linux-build/core
&& /usr/bin/g++ -DZXing_EXPORTS
-I/builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/core/src
-I/builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/redhat-linux-build/core -O2
-flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall
-Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3
-Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=z13
-mtune=z14 -fasynchronous-unwind-tables -fstack-clash-protection -O2 -g -DNDEBUG
-std=c++17 -fPIC -DZXING_BUILD_READERS -DZXING_BUILD_WRITERS -Wall -Wextra
-Wno-missing-braces -Werror=undef -Werror=return-type -ffloat-store -MD -MT
core/CMakeFiles/ZXing.dir/src/PerspectiveTransform.cpp.o -MF
CMakeFiles/ZXing.dir/src/PerspectiveTransform.cpp.o.d -o
CMakeFiles/ZXing.dir/src/PerspectiveTransform.cpp.o -c
/builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/core/src/PerspectiveTransform.cpp
/builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/core/src/PerspectiveTransform.cpp:
In member function ‘ZXing::PerspectiveTransform::operator()(ZXing::PointT<double>)
const’:
/builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/core/src/PerspectiveTransform.cpp:79:1:
error: unrecognizable insn:
79 | }
| ^
(insn 16 15 17 2 (set (reg:V2DF 70 [ vect_p_x_26.112_35 ])
(vec_duplicate:V2DF (vec_select:DF (mem/c:V2DF (reg/f:DI 69) [69 vect_p_x_26.111+0
S16 A64])
(parallel [
(const_int 0 [0])
])))) -1
(nil))
*** 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: vregs
/builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/core/src/PerspectiveTransform.cpp:79:1:
internal compiler error: in extract_insn, at recog.cc:2812
[ 22%] Building CXX object core/CMakeFiles/ZXing.dir/src/ReadBarcode.cpp.o
cd /builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/redhat-linux-build/core
&& /usr/bin/g++ -DZXing_EXPORTS
-I/builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/core/src
-I/builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/redhat-linux-build/core -O2
-flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall
-Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3
-Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=z13
-mtune=z14 -fasynchronous-unwind-tables -fstack-clash-protection -O2 -g -DNDEBUG
-std=c++17 -fPIC -DZXING_BUILD_READERS -DZXING_BUILD_WRITERS -Wall -Wextra
-Wno-missing-braces -Werror=undef -Werror=return-type -ffloat-store -MD -MT
core/CMakeFiles/ZXing.dir/src/ReadBarcode.cpp.o -MF
CMakeFiles/ZXing.dir/src/ReadBarcode.cpp.o.d -o CMakeFiles/ZXing.dir/src/ReadBarcode.cpp.o
-c /builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/core/src/ReadBarcode.cpp
Please submit a full bug report, with preprocessed source (by using -freport-bug).
See <http://bugzilla.redhat.com/bugzilla> for instructions.
[ 23%] Building CXX object core/CMakeFiles/ZXing.dir/src/ReedSolomonDecoder.cpp.o
cd /builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/redhat-linux-build/core
&& /usr/bin/g++ -DZXing_EXPORTS
-I/builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/core/src
-I/builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/redhat-linux-build/core -O2
-flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall
-Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3
-Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=z13
-mtune=z14 -fasynchronous-unwind-tables -fstack-clash-protection -O2 -g -DNDEBUG
-std=c++17 -fPIC -DZXING_BUILD_READERS -DZXING_BUILD_WRITERS -Wall -Wextra
-Wno-missing-braces -Werror=undef -Werror=return-type -ffloat-store -MD -MT
core/CMakeFiles/ZXing.dir/src/ReedSolomonDecoder.cpp.o -MF
CMakeFiles/ZXing.dir/src/ReedSolomonDecoder.cpp.o.d -o
CMakeFiles/ZXing.dir/src/ReedSolomonDecoder.cpp.o -c
/builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/core/src/ReedSolomonDecoder.cpp
[ 24%] Building CXX object core/CMakeFiles/ZXing.dir/src/Result.cpp.o
cd /builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/redhat-linux-build/core
&& /usr/bin/g++ -DZXing_EXPORTS
-I/builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/core/src
-I/builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/redhat-linux-build/core -O2
-flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall
-Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3
-Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=z13
-mtune=z14 -fasynchronous-unwind-tables -fstack-clash-protection -O2 -g -DNDEBUG
-std=c++17 -fPIC -DZXING_BUILD_READERS -DZXING_BUILD_WRITERS -Wall -Wextra
-Wno-missing-braces -Werror=undef -Werror=return-type -ffloat-store -MD -MT
core/CMakeFiles/ZXing.dir/src/Result.cpp.o -MF CMakeFiles/ZXing.dir/src/Result.cpp.o.d -o
CMakeFiles/ZXing.dir/src/Result.cpp.o -c
/builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/core/src/Result.cpp
[ 25%] Building CXX object core/CMakeFiles/ZXing.dir/src/ResultPoint.cpp.o
cd /builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/redhat-linux-build/core
&& /usr/bin/g++ -DZXing_EXPORTS
-I/builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/core/src
-I/builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/redhat-linux-build/core -O2
-flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall
-Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3
-Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=z13
-mtune=z14 -fasynchronous-unwind-tables -fstack-clash-protection -O2 -g -DNDEBUG
-std=c++17 -fPIC -DZXING_BUILD_READERS -DZXING_BUILD_WRITERS -Wall -Wextra
-Wno-missing-braces -Werror=undef -Werror=return-type -ffloat-store -MD -MT
core/CMakeFiles/ZXing.dir/src/ResultPoint.cpp.o -MF
CMakeFiles/ZXing.dir/src/ResultPoint.cpp.o.d -o CMakeFiles/ZXing.dir/src/ResultPoint.cpp.o
-c /builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/core/src/ResultPoint.cpp
The bug is not reproducible, so it is likely a hardware or OS problem.
gmake[2]: *** [core/CMakeFiles/ZXing.dir/build.make:387:
core/CMakeFiles/ZXing.dir/src/PerspectiveTransform.cpp.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
gmake[2]: Leaving directory
'/builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/redhat-linux-build'
gmake[1]: Leaving directory
'/builddir/build/BUILD/zxing-cpp-2.2.1-build/zxing-cpp-2.2.1/redhat-linux-build'
gmake[1]: *** [CMakeFiles/Makefile2:119: core/CMakeFiles/ZXing.dir/all] Error 2
gmake: *** [Makefile:149: all] Error 2
```

[1] https://koji.fedoraproject.org/koji/taskinfo?taskID=118870207
[2] https://kojipkgs.fedoraproject.org//work/tasks/701/118870701/build.log

Reproducible: Always

Comment 1 Dan Horák 2024-06-17 06:39:13 UTC
Created attachment 2037550 [details]
preprocessed sources

minimal command to reproduce the issue is
/usr/libexec/gcc/s390x-redhat-linux/14/cc1plus  -O2 -ffloat-store -march=z13 PerspectiveTransform.i
with gcc-14.1.1-5.fc40.s390x

and it looks to me the condition to expose the ICE is -O2 AND -ffloat-store AND -march >= z13

/home/sharkcz/zxing-cpp/zxing-cpp-2.0.0/core/src/PerspectiveTransform.cpp: In member function ‘ZXing::PointF ZXing::PerspectiveTransform::operator()(ZXing::PointF) const’:
/home/sharkcz/zxing-cpp/zxing-cpp-2.0.0/core/src/PerspectiveTransform.cpp:79:1: error: unrecognizable insn:
   79 | }
      | ^
(insn 16 15 17 2 (set (reg:V2DF 70 [ vect_p_x_26.114_35 ])
        (vec_duplicate:V2DF (vec_select:DF (mem/c:V2DF (reg/f:DI 69) [4 vect_p_x_26.113+0 S16 A64])
                (parallel [
                        (const_int 0 [0])
                    ])))) -1
     (nil))

Breakpoint 1, internal_error (gmsgid=gmsgid@entry=0x27b4ce2 "in %s, at %s:%d") at ../../gcc/diagnostic.cc:2384
2384	  global_dc->begin_group ();
(gdb) where
#0  internal_error (gmsgid=gmsgid@entry=0x27b4ce2 "in %s, at %s:%d") at ../../gcc/diagnostic.cc:2384
#1  0x00000000016c8324 in fancy_abort (file=<optimized out>, line=2812, function=0x272919e "extract_insn") at ../../gcc/diagnostic.cc:2353
#2  0x00000000013b1806 in _fatal_insn (msgid=msgid@entry=0x27291e0 "unrecognizable insn:", insn=0x3fff49f3ec0, file=0x27266f0 "../../gcc/recog.cc", line=2812, 
    function=function@entry=0x272919e "extract_insn") at ../../gcc/rtl-error.cc:108
#3  0x00000000013b183a in _fatal_insn_not_found (insn=<optimized out>, file=<optimized out>, line=<optimized out>, function=0x272919e "extract_insn") at ../../gcc/rtl-error.cc:116
#4  0x0000000001d40518 in extract_insn (insn=insn@entry=0x3fff49f3ec0) at ../../gcc/recog.cc:2812
#5  0x0000000001d3ea30 in instantiate_virtual_regs_in_insn (insn=<optimized out>) at ../../gcc/function.cc:1612
#6  instantiate_virtual_regs () at ../../gcc/function.cc:1995
#7  (anonymous namespace)::pass_instantiate_virtual_regs::execute (this=this@entry=0x2ab0560) at ../../gcc/function.cc:2042
#8  0x00000000017b3258 in execute_one_pass (pass=0x2ab0560) at ../../gcc/passes.cc:2647
#9  0x00000000018e998a in execute_pass_list_1 (pass=0x2ab0560) at ../../gcc/passes.cc:2756
#10 execute_pass_list_1 (pass=0x2ab0500) at ../../gcc/passes.cc:2757
#11 0x00000000018e8b02 in execute_pass_list (fn=<optimized out>, pass=<optimized out>) at ../../gcc/passes.cc:2767
#12 0x0000000001832cd4 in cgraph_node::expand (this=0x3fff530f440) at ../../gcc/cgraphunit.cc:1845
#13 0x0000000002108006 in expand_all_functions () at ../../gcc/cgraphunit.cc:2028
#14 symbol_table::compile (this=0x3fff786e000) at ../../gcc/cgraphunit.cc:2404
#15 0x0000000002117444 in symbol_table::finalize_compilation_unit (this=0x3fff786e000) at ../../gcc/cgraphunit.cc:2589
#16 0x00000000020d7354 in compile_file () at ../../gcc/toplev.cc:479
#17 0x000000000206cdf8 in do_compile () at ../../gcc/toplev.cc:2157
#18 toplev::main (this=this@entry=0x3ffffff9e7e, argc=<optimized out>, argv=<optimized out>) at ../../gcc/toplev.cc:2315
#19 0x000000000206be84 in main (argc=<optimized out>, argv=<optimized out>) at ../../gcc/main.cc:39

Comment 2 Dan Horák 2024-06-17 09:06:38 UTC
minimized testcase using cvise

--- /home/sharkcz/zxing-cpp/zxing-cpp-2.0.0/redhat-linux-build/testcase.i ---
template <typename T> struct PointT {
  T x, y;
};
using PointF = PointT<double>;
namespace std {
class PerspectiveTransform {
  PointF operator()(PointF) const;
};
PointF PerspectiveTransform::operator()(PointF p) const {
  auto denominator = p.y;
  return {0 / denominator, p.x / denominator};
}
} // namespace std

Comment 3 Jakub Jelinek 2024-06-17 09:44:56 UTC
Even more reduced:
/* { dg-do compile } */
/* { dg-options "-O2 -ffloat-store -march=z13" } */

typedef double V __attribute__((vector_size (16)));
typedef long W __attribute__((vector_size (16)));

V
foo (V x)
{
  return __builtin_shuffle (x, (W) { 1, 1 });
}

Doesn't ICE on the trunk.

Comment 4 Jakub Jelinek 2024-06-17 10:55:00 UTC
https://gcc.gnu.org/r15-1129 aka https://gcc.gnu.org/pipermail/gcc-patches/2024-June/654028.html fixed this on the trunk (but hasn't been backported yet).
Note, there is https://gcc.gnu.org/r15-1344 follow-up needed for it and the question what to do with the test on s390 in case testing is done on pre-z14
hw.

Comment 5 Jakub Jelinek 2024-06-20 10:38:12 UTC
*** Bug 2293207 has been marked as a duplicate of this bug. ***

Comment 6 Dan Horák 2024-06-21 16:11:17 UTC
zxing-cpp builds again with gcc-14.1.1-6.fc41, see https://koji.fedoraproject.org/koji/taskinfo?taskID=119394297

Comment 7 Aoife Moloney 2025-02-26 13:03:59 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 42 development cycle.
Changing version to 42.