]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Incorrect warning redundant parens on in
authorBob Duff <duff@adacore.com>
Mon, 6 Oct 2025 10:56:34 +0000 (06:56 -0400)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 3 Nov 2025 14:15:15 +0000 (15:15 +0100)
commitbd03df4cac5af997df9668a533fa23b1c867d5d0
treec2d39494d871a29d503dde89bf86cd42dbbaa94b
parente95656d98401f820227a194de20233256c511f85
ada: Incorrect warning redundant parens on in

This patch fixes a bug where GNAT gives a warning
about redundant parentheses on expressions like "(X in S) = B".
In fact, the parentheses are required in this case.

The bug is caused by constant-folding the expression into
an expression that does not require parentheses, but in
a way that retains the parentheses. The fix is to look
at Original_Node.

gcc/ada/ChangeLog:

* style.adb (Check_Xtra_Parens_Precedence):
Give warning based on Original_Node.
gcc/ada/style.adb