[gcc r12-3695] [Ada] Don't examine all discriminants when looking for the first one

Pierre-Marie de Rodat pmderodat@gcc.gnu.org
Mon Sep 20 13:04:22 GMT 2021


https://gcc.gnu.org/g:2743363047517c25a884fcf8e08a8108f1368fa6

commit r12-3695-g2743363047517c25a884fcf8e08a8108f1368fa6
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Wed Jun 23 10:17:24 2021 +0200

    [Ada] Don't examine all discriminants when looking for the first one
    
    gcc/ada/
    
            * sem_ch3.adb (Build_Discriminant_Constraints): Exit once a
            first discriminant is found and the Discrim_Present flag is set.

Diff:
---
 gcc/ada/sem_ch3.adb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index e9b445619ea..dbcb0babb5d 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -10392,6 +10392,7 @@ package body Sem_Ch3 is
               (Discr_Expr (J), Check_Concurrent => True)
          then
             Discrim_Present := True;
+            exit;
          end if;
       end loop;


More information about the Gcc-cvs mailing list