https://gcc.gnu.org/g:615c33804f6a1d3f6dcc02308f59b24c735881dc

commit r15-197-g615c33804f6a1d3f6dcc02308f59b24c735881dc
Author: Ronan Desplanques <desplanq...@adacore.com>
Date:   Wed Jan 3 12:09:03 2024 +0100

    ada: Tweak discriminant source locations
    
    This patch changes the source location information for the default
    expressions of discrimants to better represent the fact that they're
    evaluated at the point of object declaration, in the cases where
    a Build_Default_Subtype optimization is performed. This fixes a
    regression with CodePeer diagnostics introduced by a recent change
    around Build_Default_Subtype optimizations.
    
    gcc/ada/
    
            * sem_util.adb (Build_Default_Subtype): Tweak source location
            information.

Diff:
---
 gcc/ada/sem_util.adb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index c47904f168c..18c9de05cf9 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -1780,7 +1780,8 @@ package body Sem_Util is
       begin
          while Present (Disc) loop
             Append_To (Constraints,
-              New_Copy_Tree (Discriminant_Default_Value (Disc)));
+                       New_Copy_Tree
+                         (Discriminant_Default_Value (Disc), New_Sloc => Loc));
             Next_Discriminant (Disc);
          end loop;

Reply via email to