diff --git a/core/thread.c b/core/thread.c index cd97c38d607f..cb828b6df4d8 100644 --- a/core/thread.c +++ b/core/thread.c @@ -178,9 +178,6 @@ uintptr_t measure_stack_free_internal(const char *stack, size_t size) uintptr_t *stackp = (uintptr_t *)(uintptr_t)stack; uintptr_t end = (uintptr_t)stack + size; - /* better be safe than sorry: align end of stack just in case */ - end &= (sizeof(uintptr_t) - 1); - /* assume that the stack grows "downwards" */ while (((uintptr_t)stackp < end) && (*stackp == (uintptr_t)stackp)) { stackp++; diff --git a/tests/core/thread_stack_alignment/tests/01-run.py b/tests/core/thread_stack_alignment/tests/01-run.py index 9f47280b333d..9a7c395a71f4 100755 --- a/tests/core/thread_stack_alignment/tests/01-run.py +++ b/tests/core/thread_stack_alignment/tests/01-run.py @@ -24,6 +24,7 @@ def testfunc(child): child.expect(r"(\{[^\n\r]*\})\r\n") stats = json.loads(child.match.group(1))["threads"][0] assert stats["name"] == "test" + assert stats["stack_used"] < stats["stack_size"] if stack_used_max < stats["stack_used"]: stack_used_max = stats["stack_used"] if stack_used_min > stats["stack_used"]: