Created attachment 51626 [details] z.tar.gz On gcc-10 glm test suite worked successfully. On gcc-11 single test fails as: glm> The following tests FAILED: glm> 39 - test-core_func_integer (Failed) I extracted self-contained example that hopefully illustrates the problem: $ g++-10 -I. -O2 core_func_integer.cpp -o a && ./a; echo $? 0 $ g++-11 -I. -O2 core_func_integer.cpp -o a && ./a; echo $? 4 $ g++-12 -I. -O2 core_func_integer.cpp -o a && ./a; echo $? 4 Adding -fno-strict-aliasing makes the test pass. Can you help me understand where alaising violation happens? I tried adding -fopt-info, but there is not much difference in the output.
Hmm: *reinterpret_cast<glm::vec<L, typename glm::detail::make_unsigned<T>::type, Q> const *>(&v) That seems like it could be a violation of C/C++ aliasing rules. This is in: template<glm::length_t L, typename T, glm::qualifier Q> static glm::vec<L, int, Q> bitCount_bitfield(glm::vec<L, T, Q> const& v)
Yeah, I think I've seen this exact bug before. Note while 'int' and 'unsigned' inter-operate wrt TBAA two structure types differing only in the signedness of a _member_ do not.
dup *** This bug has been marked as a duplicate of bug 98594 ***
Thank you! Added a link to upstream issue report: https://github.com/g-truc/glm/pull/1087