From 70c947e4dfaa6d63b5efc0d8cd990726a9b6d8ba Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Sat, 30 Oct 2021 06:36:05 -0300 Subject: [PATCH] Implied compares in Ada Harded Conditionals documentation 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. --- gcc/ada/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 52240d7..cf76938 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 -- 2.7.4