[Bug c/53970] New: -ftree-vectorization does not handle well unaligned data
hayim at post dot tau.ac.il
gcc-bugzilla@gcc.gnu.org
Sun Jul 15 08:40:00 GMT 2012
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)
More information about the Gcc-bugs
mailing list