https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66194
Bug ID: 66194
Summary: emit vectorization instruction for not aligned
data(amd64), -fno-strict-aliasing not help
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: dushistov at mail dot ru
Target Milestone: ---
Created attachment 35562
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35562&action=edit
code example
If such code compiled
1)with optinos -fno-strict-aliasing -O3 -std=c99
2)as separate module
3)amd64
then it crashes if "key" misaligned:
void
dummyhash (const void *key, int len, uint32_t seed, void *out)
{
uint32_t h = seed, *pk = (uint32_t *)key;
for (; len > 3; len -= 4, pk++)
h ^= (*pk + len);
const unsigned char *s = (unsigned char *)pk;
switch (len) {
case 3:
h ^= ((*s++ + 3) << 24);
case 2:
h ^= ((*s++ + 2) << 16);
case 1:
h ^= (*s + 1);
}
*(uint32_t*)out = h;
}
With -O2 works fine, I attach full example and makefile to bug.
With clang 3.6.0 and icc (ICC) 13.1.3 20130607 all works fine.