]> gcc.gnu.org Git - gcc.git/commit
[Ada] Detect infinite loops with operators in exit conditions
authorPiotr Trojanek <trojanek@adacore.com>
Wed, 2 Feb 2022 16:19:59 +0000 (17:19 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 11 May 2022 08:53:20 +0000 (08:53 +0000)
commitdc9ecb41c8572c53bdcd86e73526e2a27bd3dff9
treea3612142caee9d326c7a0fa31d70958c4f24a67c
parent4c533da21d6298cdf9eb11df7353b8c8684c7756
[Ada] Detect infinite loops with operators in exit conditions

To warn about infinite loops we detect variables referenced in loop exit
conditions. We handle references within boolean operators, i.e.
comparison and negation, which are likely to appear at the top level of
the condition (e.g. "X > 0"). However, we can easily handle all
operators, because they are likely to appear inside the condition (e.g.
"abs (X) > 0.0").

Cleanup related to a new restriction No_Uninitialized_Local_Scalars.

gcc/ada/

* sem_warn.adb (Find_Var): Detect all operators; replace
"condition" to "expression" in comments, because when this
routine is called recursively it no longer examines the
condition.
(Is_Suspicious_Function_Name): Reduce scope of a local variable
to avoid shadowing with a parameter of a nested
Substring_Present function.
gcc/ada/sem_warn.adb
This page took 0.061414 seconds and 6 git commands to generate.