Skip to content
Commit 9672858c authored by Stephanos Ioannidis's avatar Stephanos Ioannidis Committed by Carles Cufí
Browse files

cmake: compiler: Add flag template for disabling strict aliasing rule



This commit adds a template for specifying the C/C++ compiler flag for
disabling the strict aliasing rule.

It also enables this flag globally because the Zephyr codebase does not
strictly adhere to the aliasing rules specified by the C/C++ standards
and the optimisation strategies that assume these rules may end up
generating invalid code.

For instance, GCC 11 and above tend to optimise more aggressively
assuming the strict adherence to the standard aliasing rules and may
generate invalid code, when compiling Zephyr with `-fstrict-aliasing`,
that results in various run-time failures.

Note that the footprint and performance ramifications of disabling the
strict aliasing rule are negligible.

Signed-off-by: default avatarStephanos Ioannidis <root@stephanos.io>
parent f5560279
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment