https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90611
Bug ID: 90611
Summary: Generating a bad sse instruction for 32 bit
Product: gcc
Version: 8.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: aaron.greig at codeplay dot com
Target Milestone: ---
Created attachment 46403
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46403&action=edit
cpp file that triggers the bug
I am finding that when I compile the attached file, with the following command:
g++-8 -m32 -std=c++11 -msse -O3 repro.cpp -o repro -Wall -Wextra
-fno-strict-aliasing -fwrapv
I get this output:
repro.cpp: In function ‘int main(int, char**)’:
repro.cpp:13:14: warning: unused parameter ‘argc’ [-Wunused-parameter]
int main(int argc, char** argv) {
^~~~
repro.cpp:13:27: warning: unused parameter ‘argv’ [-Wunused-parameter]
int main(int argc, char** argv) {
~~~^~~~
and when I run the resulting binary on a 32-bit system I get an immediate
segfault. This seems to be due to a movaps instruction generating a general
protection exception (see https://www.felixcloutier.com/x86/movaps) because the
address it is loading from isn't aligned to 16 bytes. The minimal command I
have found to reproduce this is
g++-8 -m32 -std=c++11 -msse -O3 repro.cpp -o repro
the output of g++-8 --version is:
g++-8 (Ubuntu 8.3.0-6ubuntu1~18.04) 8.3.0
The system I run the binary on is a virtualbox VM with 32-bit Ubuntu 16.04
installed on it. I can reproduce this bug in the same way by compiling with
that system's installed g++, version:
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609