FYI, I'm putting in this follow-up tweak to the GNAT manual.
Implied compares in Ada Harded Conditionals documentation From: Alexandre Oliva <ol...@adacore.com> Improve the wording on optimizations that prevent compare hardening, so as to also cover cases in which explicit compares get combined into operations with implied compares. for gcc/ada/ChangeLog * doc/gnat_rm/security_hardening_features.rst: Mention optimization to operations with implied compares. --- .../doc/gnat_rm/security_hardening_features.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gcc/ada/doc/gnat_rm/security_hardening_features.rst b/gcc/ada/doc/gnat_rm/security_hardening_features.rst index 52240d7e3dd54..cf76938d91d13 100644 --- a/gcc/ada/doc/gnat_rm/security_hardening_features.rst +++ b/gcc/ada/doc/gnat_rm/security_hardening_features.rst @@ -112,14 +112,15 @@ long after boolean expressions are decomposed into separate compares, each one turned into either a conditional branch or a compare whose result is stored in a boolean variable or temporary. Compiler optimizations, if enabled, may also turn conditional branches into -stored compares, and vice-versa. Conditionals may also be optimized +stored compares, and vice-versa, or into operations with implied +conditionals (e.g. MIN and MAX). Conditionals may also be optimized out entirely, if their value can be determined at compile time, and occasionally multiple compares can be combined into one. It is thus difficult to predict which of these two options will affect a specific compare operation expressed in source code. Using both -options ensures that every compare that is not optimized out will be -hardened. +options ensures that every compare that is neither optimized out nor +optimized into implied conditionals will be hardened. The addition of reversed compares can be observed by enabling the dump files of the corresponding passes, through command line options -- Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer Disinformation flourishes because many people care deeply about injustice but very few check the facts. Ask me about <https://stallmansupport.org>