https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102074
Bug ID: 102074
Summary: include/bits/atomic_timed_wait.h:215: possible missing
return ?
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: dcb314 at hotmail dot com
Target Milestone: ---
libstdc++-v3/include/bits/atomic_timed_wait.h:215:6: error: Found a exit path
from function with non-void return type that has missing return statement
[missingReturn]
Source code is
{
#ifdef _GLIBCXX_HAVE_PLATFORM_TIMED_WAIT
return __platform_wait_until(__addr, __old, __atime);
#else
__platform_wait_t __val;
__atomic_load(__addr, &__val, __ATOMIC_RELAXED);
if (__val == __old)
{
lock_guard<mutex> __l(_M_mtx);
return __cond_wait_until(_M_cv, _M_mtx, __atime);
}
#endif // _GLIBCXX_HAVE_PLATFORM_TIMED_WAIT
}
I see no code for __val != __old, not even some rarely executed error handling
code.
Static analyser cppcheck found this possible problem.