[Ada] Issue warning on unused quantified expression

Pierre-Marie de Rodat derodat@adacore.com
Wed Oct 20 19:27:26 GMT 2021


It is common that a quantified expression takes the form of a
conjunction or disjunction. In such a case, it is expected that all
conjuncts/ disjuncts reference the quantified variable. Not doing so can
be either the symptom of an error, or of a non-optimal expression, as
that sub-expression could be extracted from the quantified expression.
This is beneficial for both execution (speed) and for proof
(automation).

Issue a warning in such a case.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* sem_ch4.adb (Analyze_QUantified_Expression): Issue warning on
	conjunct/disjunct sub-expression of the full expression inside a
	quantified expression, when it does not reference the quantified
	variable.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 3395 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20211020/314334f5/attachment-0001.bin>


More information about the Gcc-patches mailing list