Bug ID | 1043966 |
---|---|
Summary | g++ 7.1.1 segfaults on gtest of boost::uuid |
Classification | openSUSE |
Product | openSUSE Tumbleweed |
Version | Current |
Hardware | x86-64 |
OS | Other |
Status | NEW |
Severity | Normal |
Priority | P5 - None |
Component | Development |
Assignee | bnc-team-screening@forge.provo.novell.com |
Reporter | andreas_nordal_4@hotmail.com |
QA Contact | qa-bugs@suse.de |
Found By | --- |
Blocker | --- |
g++ 7.1.1 crashes on this code when compiled with -O2 on x86_64: > #include <gtest/gtest.h> > #include <boost/uuid/uuid.hpp> > > void crash_gcc7() > { > static const boost::uuids::uuid u = boost::uuids::uuid(); > EXPECT_EQ(u, u); > } This was reduced from a large unittest at work. Further reduced by inlining gtest & boost headers: > class AssertionResult { > bool success_; > }; > > AssertionResult AssertionSuccess(); > > template <typename T1> > AssertionResult EXPECT_EQ(const T1& expected, const T1& actual) { > if (expected == actual) { > return AssertionSuccess(); > } > return AssertionSuccess(); > } > > struct uuid > { > // or should it be array<unsigned char, 16> > unsigned char data[16]; > }; > > bool operator== (uuid const& lhs, uuid const& rhs); > > #include <emmintrin.h> > > __m128i load_unaligned_si128(const unsigned char* p) > { > return _mm_loadu_si128(reinterpret_cast< const __m128i* >(p)); > } > > inline bool operator== (uuid const& lhs, uuid const& rhs) > { > __m128i mm_left = load_unaligned_si128(lhs.data); > __m128i mm_right = load_unaligned_si128(rhs.data); > > __m128i mm_cmp = _mm_cmpeq_epi32(mm_left, mm_right); > > return _mm_movemask_epi8(mm_cmp) == 0xFFFF; > } > > void crash_gcc7() > { > static const uuid u = uuid(); > EXPECT_EQ(u, u); > } Note1: The boost implementation had an SSE2 optimized version and a generic version. The generic version does NOT crash g++. Note2: emmintrin.h seems to be a GCC header: /usr/lib64/gcc/x86_64-suse-linux/7/include/emmintrin.h