Skip to content

Commit

Permalink
tests/unittests: disable optimization for test_atomic_inc_rollover
Browse files Browse the repository at this point in the history
Disable optimization for this function only with CPU_SAML1X MCUs due to an internal crosscompiler bug
  • Loading branch information
dylad committed Jan 21, 2019
1 parent b3e1802 commit 762e525
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/unittests/tests-core/tests-core-atomic.c
Expand Up @@ -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);
Expand All @@ -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)
{
Expand Down

0 comments on commit 762e525

Please sign in to comment.