This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/61282] New: vectorisation causes segfaults in a compiled program during access to an int-casted char[] after bool in a struct
- From: "v_pimenov at wargaming dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 22 May 2014 06:38:07 +0000
- Subject: [Bug c++/61282] New: vectorisation causes segfaults in a compiled program during access to an int-casted char[] after bool in a struct
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61282
Bug ID: 61282
Summary: vectorisation causes segfaults in a compiled program
during access to an int-casted char[] after bool in a
struct
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: v_pimenov at wargaming dot net
Created attachment 32842
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32842&action=edit
Example source file that produces segfaulting code
When char[] follows a bool in a class, it is 1-byte aligned.
When casted to an int later, gcc 4.7.2 can optimise some operations to use SIMD
instructions that segfault on unaligned access.
In this exact case body of
> for(i=0;i<bound;i++)
> sum ^= p[i];
was optimised to
> pxor (%rdi),%xmm0
which segfaults when
> %rdi % sizeof(void*) != 0
To reproduce compile the attached example source file with
> g++ -fPIC -msse3 -O3 test.cpp
run the executable and observe a SIGSEGV.