https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64203
Bug ID: 64203 Summary: shared_mutex compile errors on bare-metal targets Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: sandra at codesourcery dot com CC: 3dw4rd at verizon dot net After merging GCC 4.9.2 onto our local branch, I saw that the new libstdc++ testcase experimental/feat-cxx14.cc is failing on bare-metal targets (arm-none-eabi, mips-sde-elf, powerpc-eabi, possibly others). Here's an excerpt from the test logs: Executing on host: mips-sde-elf-g++ -fdiagnostics-color=never -D_GLIBCXX_ASSERT -fmessage-length=0 -g -O2 -DLOCALEDIR="." -I/scratch/sandra/mips-elf-trunk/src/gcc-trunk-4.9/libstdc++-v3/testsuite/util /scratch/sandra/mips-elf-trunk/src/gcc-trunk-4.9/libstdc++-v3/testsuite/experimental/feat-cxx14.cc -std=gnu++14 -S -mips16 -o feat-cxx14.s (timeout = 600) /scratch/sandra/mips-elf-trunk/src/gcc-trunk-4.9/libstdc++-v3/testsuite/experimental/feat-cxx14.cc:110:4: error: #error "__cpp_lib_shared_timed_mutex" # error "__cpp_lib_shared_timed_mutex" ^ In file included from /scratch/sandra/mips-elf-trunk/src/gcc-trunk-4.9/libstdc++-v3/testsuite/experimental/feat-cxx14.cc:13:0: /scratch/sandra/mips-elf-trunk/install/opt/codesourcery/mips-sde-elf/include/c++/4.9.2/shared_mutex:274:36: error: 'defer_lock_t' has not been declared shared_lock(mutex_type& __m, defer_lock_t) noexcept ^ /scratch/sandra/mips-elf-trunk/install/opt/codesourcery/mips-sde-elf/include/c++/4.9.2/shared_mutex:277:36: error: 'try_to_lock_t' has not been declared shared_lock(mutex_type& __m, try_to_lock_t) ^ /scratch/sandra/mips-elf-trunk/install/opt/codesourcery/mips-sde-elf/include/c++/4.9.2/shared_mutex:277:7: error: 'std::shared_lock<_Mutex>::shared_lock(std::shared_lock<_Mutex>::mutex_type&, int)' cannot be overloaded shared_lock(mutex_type& __m, try_to_lock_t) ^ /scratch/sandra/mips-elf-trunk/install/opt/codesourcery/mips-sde-elf/include/c++/4.9.2/shared_mutex:274:7: error: with 'std::shared_lock<_Mutex>::shared_lock(std::shared_lock<_Mutex>::mutex_type&, int)' shared_lock(mutex_type& __m, defer_lock_t) noexcept ^ /scratch/sandra/mips-elf-trunk/install/opt/codesourcery/mips-sde-elf/include/c++/4.9.2/shared_mutex:280:36: error: 'adopt_lock_t' has not been declared shared_lock(mutex_type& __m, adopt_lock_t) ^ /scratch/sandra/mips-elf-trunk/install/opt/codesourcery/mips-sde-elf/include/c++/4.9.2/shared_mutex:280:7: error: 'std::shared_lock<_Mutex>::shared_lock(std::shared_lock<_Mutex>::mutex_type&, int)' cannot be overloaded shared_lock(mutex_type& __m, adopt_lock_t) ^ /scratch/sandra/mips-elf-trunk/install/opt/codesourcery/mips-sde-elf/include/c++/4.9.2/shared_mutex:274:7: error: with 'std::shared_lock<_Mutex>::shared_lock(std::shared_lock<_Mutex>::mutex_type&, int)' shared_lock(mutex_type& __m, defer_lock_t) noexcept ^ /scratch/sandra/mips-elf-trunk/install/opt/codesourcery/mips-sde-elf/include/c++/4.9.2/shared_mutex: In member function 'void std::shared_lock<_Mutex>::unlock()': /scratch/sandra/mips-elf-trunk/install/opt/codesourcery/mips-sde-elf/include/c++/4.9.2/shared_mutex:347:29: error: 'errc' was not declared in this scope __throw_system_error(int(errc::resource_deadlock_would_occur)); ^ /scratch/sandra/mips-elf-trunk/install/opt/codesourcery/mips-sde-elf/include/c++/4.9.2/shared_mutex: In member function 'void std::shared_lock<_Mutex>::_M_lockable() const': /scratch/sandra/mips-elf-trunk/install/opt/codesourcery/mips-sde-elf/include/c++/4.9.2/shared_mutex:381:29: error: 'errc' was not declared in this scope __throw_system_error(int(errc::operation_not_permitted)); ^ /scratch/sandra/mips-elf-trunk/install/opt/codesourcery/mips-sde-elf/include/c++/4.9.2/shared_mutex:383:29: error: 'errc' was not declared in this scope __throw_system_error(int(errc::resource_deadlock_would_occur)); ^ compiler exited with status 1 I am guessing this part of <shared_mutex> is to blame: #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) # include <mutex> # include <condition_variable> #endif Because of the guards, I think <mutex> is not being included and nothing else is providing declarations of the missing identifiers. I don't know my way around this code or the C++ library specification at all, though.