This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Clang v6.15 atomic_compare_exchange_strong () causes osRtxErrorNotify () call

Hi,

When executing this code on cortex M3

#include <stdatomic.h>

void atomic_swap ()
{
	_Atomic int a = 5;
	int         b = 5;
	if ( true == atomic_compare_exchange_strong ( & a, & b, 5) )
		__breakpoint ( 2 ); // this is never reached
}

why atomic_compare_exchange_strong () does not return true and hit the __breakpoint () ?

'a' and 'b' are equal so according to https://en.cppreference.com/w/c/atomic/atomic_compare_exchange 'true' should be returned.

Thanks