POWER9 emulation is broken when compiler optimizations are on (for gcc 11.3 and later)
Host environment
- Operating system: Ubuntu MATE 22.04.2 LTS
- OS/kernel version: 5.19.0-32-generic
- Architecture: x86_64
- QEMU flavor: qemu-ppc64le
- QEMU version: any prior to 7.x.y (tried 4.2.0, 5.1.0, 6.2.0)
- QEMU command line: qemu-ppc64le -cpu POWER9 test_p64
Description of problem
Comparing two floating point memory operands produces incorrect result
Steps to reproduce
- Unpack attached archive and change to test_p64 directory
- Build the source file with: powerpc64le-linux-gnu-g++ -O2 -static test.cpp -o test_p64
- Run with QEMU: qemu-ppc64le -cpu POWER9 test_p64 > output.txt
- Check the output text file output.txt (with pluma or any other text editor) to see the printouts
Additional information
The pre-built binary and its output file are attached as test_p64.tar.gztest_p64.tar.gz
The purpose of this report is to motivate the creation of a point release QEMU 6.2.1 for Ubuntu 22.04 LTS (which will be supported for years to come). Also cross-linking similar bug report for MIPS with exact same goal: #1531 (closed)