From: Eric Botcazou <[email protected]>

This happens when the units of a program using the standard containers are
not uniformly compiled with the -gnatVo switch.  This is the fallout of an
internal confusion as to what validity checks must be applied to.

gcc/ada/ChangeLog:

        * exp_ch4.adb (Expand_N_Op_Eq): Do not expand an array comparison
        for validity checking purposes when the component type is covered
        by the suppression of validity checks.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/exp_ch4.adb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 533e2f0d754..9a77084f524 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -8582,6 +8582,8 @@ package body Exp_Ch4 is
 
          if Validity_Check_Operands
            and then not Is_Known_Valid (Component_Type (Typl))
+           and then not
+             Is_Check_Suppressed (Component_Type (Typl), Validity_Check)
          then
             declare
                Save_Force_Validity_Checks : constant Boolean :=
-- 
2.53.0

Reply via email to