This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/53970] New: -ftree-vectorization does not handle well unaligned data
- From: "hayim at post dot tau.ac.il" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 15 Jul 2012 08:40:25 +0000
- Subject: [Bug c/53970] New: -ftree-vectorization does not handle well unaligned data
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53970
Bug #: 53970
Summary: -ftree-vectorization does not handle well unaligned
data
Classification: Unclassified
Product: gcc
Version: 4.6.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: hayim@post.tau.ac.il
When compiling this code:
#pragma pack(1)
struct mystruct {
char c;
unsigned long l[1024];
};
#pragma pack()
int main(int argc, char **argv) {
mystruct *a = new mystruct;
unsigned long long i;
for (i = 0; i < 1024; ++i)
a->l[i] = 0xdeadbeaf;
}
with -O2 -ftree-vectorize -Wall, the code crashes.
More specifically, the loop is vectorized assuming alignment (movdqa), which
causes the crash.
I think the proper behaviour should be to print a warning message at compile
time that an unaligned data is used, or even vectorize the loop without
assuming alignment.
(co-finders: Tomer Cohen and Ofek Ben-Arie)