Dereference breaks strict aliasing
maedoc opened this issue · comments
Thanks for the header. I dropped this into a project with a bit of SSE2, but the compiler (GCC 5.4) is complaining that e.g.
/work/freesurfer/include/sse2neon.h:382:59: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
#define vreinterpretq_nth_u8_m128i(x, n) (((SIMDVec *) &x)->m128_u8[n])
^
/work/freesurfer/include/sse2neon.h:8600:31: note: in expansion of macro 'vreinterpretq_nth_u8_m128i'
v[i / 4][i % 4] ^ vreinterpretq_nth_u8_m128i(RoundKey, i);
This project treats warnings as errors. Because of how SIMD works, I assume this isn't fixable but if there are any workarounds, I would be happy to try them out.
Can you share the reason why you would stick to gcc-5.4, which was released in 2016? Which kind of applications did you attempt to adopt SSE2NEON with?
The compiler version is a good question. I will try to update it to something more recent.
The application is FreeSurfer a widely used neuroimaging analysis toolbox, which has some SSE2 bits (20 lines maybe) hard coded.
More recent compiler versions don't like some of the C++ code in the project, so I'm a bit blocked. I will probably just port the SSE2 operations to regular C++.