Skip to content

Commit f9b51d7

Browse files
committed
suppress a strict aliasing warning; the original author was very clear about the nature of the problematic code
1 parent efa50da commit f9b51d7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/dotproductavx.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ double DotProductAVX(const double* u, const double* v, int n) {
9090
// instruction, as that introduces a 70 cycle delay. All this casting is to
9191
// fool the intrinsics into thinking we are extracting the bottom int64.
9292
auto cast_sum = _mm256_castpd_si256(sum);
93+
#pragma GCC diagnostic push
94+
#pragma GCC diagnostic ignored "-Wstrict-aliasing")
9395
*(reinterpret_cast<int64_t*>(&result)) =
9496
#if defined(_WIN32) || defined(__i386__)
9597
// This is a very simple workaround that is activated
@@ -100,6 +102,7 @@ double DotProductAVX(const double* u, const double* v, int n) {
100102
_mm256_extract_epi64(cast_sum, 0)
101103
#endif
102104
;
105+
#pragma GCC diagnostic pop
103106
while (offset < n) {
104107
result += u[offset] * v[offset];
105108
++offset;

0 commit comments

Comments
 (0)