aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_res.adb
diff options
context:
space:
mode:
authorRonan Desplanques <desplanques@adacore.com>2024-02-27 15:46:14 +0100
committerMarc Poulhiès <poulhies@adacore.com>2024-05-16 10:49:33 +0200
commit5c9205a4d729e6fe9b8c897f4eb3ccd86dcf1835 (patch)
treeebd1811060fb9533d96b537988efe17cdb3ffbf9 /gcc/ada/sem_res.adb
parentea648848eac40e07df0b0e1f5762b5d3f3f738c6 (diff)
downloadgcc-5c9205a4d729e6fe9b8c897f4eb3ccd86dcf1835.zip
gcc-5c9205a4d729e6fe9b8c897f4eb3ccd86dcf1835.tar.gz
gcc-5c9205a4d729e6fe9b8c897f4eb3ccd86dcf1835.tar.bz2
ada: Fix missing length checks with case expressions
This fixes an issue where length checks were not generated when the right-hand side of an assigment involved a case expression. gcc/ada/ * sem_res.adb (Resolve_Case_Expression): Add length check insertion. * exp_ch4.adb (Expand_N_Case_Expression): Add handling of nodes known to raise Constraint_Error.
Diffstat (limited to 'gcc/ada/sem_res.adb')
-rw-r--r--gcc/ada/sem_res.adb3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 85795ba..d2eca7c 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -7438,6 +7438,9 @@ package body Sem_Res is
if Is_Scalar_Type (Alt_Typ) and then Alt_Typ /= Typ then
Rewrite (Alt_Expr, Convert_To (Typ, Alt_Expr));
Analyze_And_Resolve (Alt_Expr, Typ);
+
+ elsif Is_Array_Type (Typ) then
+ Apply_Length_Check (Alt_Expr, Typ);
end if;
Next (Alt);