]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Apply fixes to Examine_Array_Bounds
authorRonan Desplanques <desplanques@adacore.com>
Thu, 6 Jun 2024 07:40:54 +0000 (09:40 +0200)
committerMarc Poulhiès <poulhies@adacore.com>
Fri, 21 Jun 2024 08:34:22 +0000 (10:34 +0200)
gcc/ada/

* sem_util.adb (Examine_Array_Bounds): Add missing return
statements. Fix criterion for a string literal being empty.

gcc/ada/sem_util.adb

index 4cdac9443e6db9e97642677e1d0c0ecd71498cab..4dde5f3964e1a988f374a2588723e12eb6ecd1fb 100644 (file)
@@ -8157,13 +8157,15 @@ package body Sem_Util is
       if not Is_Constrained (Typ) then
          All_Static := False;
          Has_Empty  := False;
+         return;
 
       --  A string literal has static bounds, and is not empty as long as it
       --  contains at least one character.
 
       elsif Ekind (Typ) = E_String_Literal_Subtype then
          All_Static := True;
-         Has_Empty  := String_Literal_Length (Typ) > 0;
+         Has_Empty  := String_Literal_Length (Typ) = 0;
+         return;
       end if;
 
       --  Assume that all bounds are static and not empty