From: Mathias Aparicio <[email protected]>
Before this patch, creating a pragma predicate with the static keyword
whose body included a case-expression where every alternative was
statically evaluated to false leads to an ICE.
When the case expression had all alternatives resolved to False,
Build_Discrete_Static_Predicate.Get_Rlist returned an Empty list and
later in the code Next was called on the Empty List.
Now return false_range in this case.
gcc/ada/ChangeLog:
* sem_ch13.adb (Build_Discrete_Static_Predicate.Get_RList): If
case expression alternatives are False return False_Range.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/sem_ch13.adb | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 722999da459..47230c2f4d7 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -10167,6 +10167,9 @@ package body Sem_Ch13 is
Next (Alt);
end loop;
+ if Is_Empty_List (Choices) then
+ return False_Range;
+ end if;
return Membership_Entries (First (Choices), Static);
end;
--
2.53.0