Skip to content
Snippets Groups Projects
Commit 762e5251 authored by Dylan Laduranty's avatar Dylan Laduranty
Browse files

tests/unittests: disable optimization for test_atomic_inc_rollover

Disable optimization for this function only with CPU_SAML1X MCUs due to an internal crosscompiler bug
parent b3e18026
No related branches found
No related tags found
No related merge requests found
......@@ -51,7 +51,11 @@ static void test_atomic_inc_negative(void)
TEST_ASSERT_EQUAL_INT(i + 1, atomic_load(&res));
}
}
/* Prevent compiler optimization for SAML1X because of gcc internal bug */
#ifdef CPU_SAML1X
#pragma GCC push_options
#pragma GCC optimize ("O0")
#endif
static void test_atomic_inc_rollover(void)
{
atomic_int res = ATOMIC_VAR_INIT(INT_MAX - 30);
......@@ -67,7 +71,9 @@ static void test_atomic_inc_rollover(void)
TEST_ASSERT_EQUAL_INT(INT_MIN + 1, atomic_fetch_add(&res, 1));
TEST_ASSERT_EQUAL_INT(INT_MIN + 2, atomic_load(&res));
}
#ifdef CPU_SAML1X
#pragma GCC pop_options
#endif
/* Test atomic_fetch_sub */
static void test_atomic_dec_negative(void)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment