bn_nist: fix strict aliasing problem#18258
Conversation
As of clang-14 the strict aliasing is causing code to magically disappear. By explicitly inlining the code, the aliasing problem evaporates. Fixes openssl#18225
|
This is the LibreSSL patch for this issue: https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/lib/libcrypto/bn/bn_nist.c.diff?r1=1.19&r2=1.20 |
|
Thanks for the counterpoint @guidovranken, @t8m any thoughts on which approach you prefer? |
|
I would rather lower the global optimization level for this compiler version. |
|
We'd need to drop it to -O1 or less. -O2 adds -fstrict-aliasing. We could single this file out for -fno-strict-aliasing, or perhaps just build everything with -fno-strict-aliasing since it isn't going to hurt the assembly code. |
|
I prefer the fix as is in this PR. It fixes the UB as it keeps the union visible in the macro. |
|
This pull request is ready to merge |
|
Merged. |
As of clang-14 the strict aliasing is causing code to magically disappear. By explicitly inlining the code, the aliasing problem evaporates. Fixes #18225 Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Tim Hudson <[email protected]> Reviewed-by: Matt Caswell <[email protected]> (Merged from #18258)
As of clang-14 the strict aliasing is causing code to magically disappear. By explicitly inlining the code, the aliasing problem evaporates. Fixes #18225 Reviewed-by: Tomas Mraz <[email protected]> Reviewed-by: Tim Hudson <[email protected]> Reviewed-by: Matt Caswell <[email protected]> (Merged from #18258) (cherry picked from commit 8712db5)
|
Any reason this wasn't backported to 1.1.1? The original issue says that 1.1.1 is also affected |
As of clang-14 the strict aliasing is causing code to magically disappear. By explicitly inlining the code, the aliasing problem evaporates. Fixes openssl#18225 Backport of openssl#18258 to 1.1.1.
I created a backport in #18948 |
As of clang-14 the strict aliasing is causing code to magically disappear. By explicitly inlining the code, the aliasing problem evaporates. Fixes #18225 Backport of #18258 to 1.1.1. Reviewed-by: Hugo Landau <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from #18948)
As of clang-14 the strict aliasing is causing code to magically disappear. By explicitly inlining the code, the aliasing problem evaporates. Fixes openssl#18225 Backport of openssl#18258 to 1.1.1. Reviewed-by: Hugo Landau <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from openssl#18948) (cherry picked from commit 6246649)
As of clang-14 the strict aliasing is causing code to magically disappear. By explicitly inlining the code, the aliasing problem evaporates. Fixes openssl#18225 Backport of openssl#18258 to 1.1.1. Reviewed-by: Hugo Landau <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from openssl#18948) (cherry picked from commit 6246649)
As of clang-14 the strict aliasing is causing code to magically disappear. By explicitly inlining the code, the aliasing problem evaporates. Fixes openssl#18225 Backport of openssl#18258 to 1.1.1. Reviewed-by: Hugo Landau <[email protected]> Reviewed-by: Tomas Mraz <[email protected]> (Merged from openssl#18948)
As of clang-14 the strict aliasing is causing code to magically disappear.
By explicitly inlining the code, the aliasing problem evaporates.
Fixes #18225
I'd like to wait until llvm/llvm-project#55255 gets commented on before commiting this.