Opened 9 years ago

Closed 9 years ago

#9694 closed Bugs (fixed)

boost/thread.hpp doesn't compile with MinGW and -march=pentium3

Reported by: Marcin Wojdyr <wojdyr@…> Owned by: Peter Dimov
Milestone: To Be Determined Component: smart_ptr
Version: Boost 1.55.0 Severity: Regression
Keywords: Cc:

Description

I get the same with two 32-bit MinGW-w64 versions: from g++ 4.8.2 from MSYS2 and g++ 4.8.1 from mingw-builds. This problem doesn't exist in boost 1.53.

$ cat test.cpp
#include <boost/thread.hpp>

$ /mingw32/bin/g++ -I./checkout/boost_1_55_0 -march=pentium3 -c test.cpp
In file included from C:/msys64/mingw32/i686-w64-mingw32/include/intrin.h:151:0,
                 from ./checkout/boost_1_55_0/boost/detail/interlocked.hpp:146,
                 from ./checkout/boost_1_55_0/boost/thread/win32/thread_primitives.hpp:17,
                 from ./checkout/boost_1_55_0/boost/thread/win32/thread_data.hpp:11,
                 from ./checkout/boost_1_55_0/boost/thread/thread_only.hpp:15,
                 from ./checkout/boost_1_55_0/boost/thread/thread.hpp:12,
                 from ./checkout/boost_1_55_0/boost/thread.hpp:13,
                 from test.cpp:1:
C:/msys64/mingw32/i686-w64-mingw32/include/dvec.h: In function 'const __m128i get_mask128()':
C:/msys64/mingw32/i686-w64-mingw32/include/dvec.h:56:83: error: '_mm_set1_epi64' was not declared in this scope
   static const __m128i mask128 = _mm_set1_epi64(M64((__int64)0xffffffffffffffffll));
                                                                                   ^
C:/msys64/mingw32/i686-w64-mingw32/include/dvec.h: In member function 'M128& M128::operator&=(const M128&)':
C:/msys64/mingw32/i686-w64-mingw32/include/dvec.h:71:78: error: '_mm_and_si128' was not declared in this scope
   M128& operator&=(const M128 &a) { return *this = (M128) _mm_and_si128(vec,a); }

Googling around I've found the same error message here: http://pastebin.com/4nXK0V73

Change History (4)

comment:1 by viboes, 9 years ago

Component: threadsmart_ptr
Owner: changed from Anthony Williams to Peter Dimov

I'm not the owner of boost/detail/interlocked.hpp. Moving to SmartPtr in case Peter Dimov is aware of the issue.

comment:2 by Peter Dimov, 9 years ago

This should be reported as a MinGW bug - their <intrin.h> header doesn't compile under -march=pentium3.

To get around this issue, try defining BOOST_USE_WINDOWS_H. This will force interlocked.hpp to include windows.h instead of intrin.h.

comment:3 by Marcin Wojdyr <wojdyr@…>, 9 years ago

thanks for looking into it

I reported it to Mingw-w64 then https://sourceforge.net/p/mingw-w64/bugs/383/

I'd close this ticket, but apparently I don't have permissions to do it.

comment:4 by Peter Dimov, 9 years ago

Resolution: fixed
Status: newclosed

OK, closed.

Note: See TracTickets for help on using tickets.