diff mbox series

[COMMITTED,9/9] ada: Fix error in GNATprove inlining with array concatenation

Message ID 20240806090241.576862-9-poulhies@adacore.com
State New
Headers show
Series [COMMITTED,1/9] ada: Reject use-clause conflicts in the run-time library | expand

Commit Message

Marc Poulhiès Aug. 6, 2024, 9:02 a.m. UTC
From: Yannick Moy <moy@adacore.com>

Wrong interpretation of the type of the concatenation can lead to a
spurious error in GNATprove when inlining code. Now fixed.

gcc/ada/

	* sem_ch4.adb (Analyze_Concatenation_Rest): Do not add a wrong
	interpretation of the concatenation, using the type of the operand
	already recognized as of the element type.

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

---
 gcc/ada/sem_ch4.adb | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index fc3a2a43c3c..9b77a81e43e 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -1995,6 +1995,7 @@  package body Sem_Ch4 is
               (Root_Type (LT) = Standard_String
                  or else Scope (LT) /= Standard_Standard)
               and then Etype (R) = Any_String
+              and then not Is_Component_Left_Opnd (N)
             then
                Add_One_Interp (N, Op_Id, LT);
 
@@ -2002,6 +2003,7 @@  package body Sem_Ch4 is
               (Root_Type (RT) = Standard_String
                  or else Scope (RT) /= Standard_Standard)
               and then Etype (L) = Any_String
+              and then not Is_Component_Right_Opnd (N)
             then
                Add_One_Interp (N, Op_Id, RT);