Skip to content
Commit 3723493f authored by Jonathon Penix's avatar Jonathon Penix Committed by Anas Nashif
Browse files

tests: coredump: Disable optimizations to prevent unexpected failures



debug.coredump.logging_backend is currently failing for most of the targets
I have tried when building with clang. Depending on the target, func_3
invokes undefined behavior by dereferencing addr (which is NULL) which
can lead to the compiler optimizing out significant portions of the code,
resulting in unexpected/incorrect failures.

Here, clang seems to inline func_3 into main then marks the inlined
implementation as unreachable (due to the UB) and removes it and everything
after it in main. So, we fall through to whatever code lies past main,
resulting in a test failure (timeout) from what I've seen. GCC seems to do
similar things, but creates an invalid opcode instruction so the test still
succeeds.

clang is correct in both optimizing this behavior out and leaving
buggy code behind, so disable optimizations for func_3 to keep things under
control and prevent the incorrect failures.

Signed-off-by: default avatarJonathon Penix <jpenix@quicinc.com>
parent a28d5df5
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment