* [COMMITTED] ada: Avoid crash on illegal constrained type declarations
@ 2024-05-13 8:35 Marc Poulhiès
0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2024-05-13 8:35 UTC (permalink / raw)
To: gcc-patches; +Cc: Piotr Trojanek
From: Piotr Trojanek <trojanek@adacore.com>
Fix crash on ACATS test B38003B introduced by a recent cleanup of
per-object constraints.
gcc/ada/
* sem_util.adb (Get_Index_Bounds): Guard against missing Entity,
which happens on illegal constrained type declaration.
Tested on x86_64-pc-linux-gnu, committed on master.
---
gcc/ada/sem_util.adb | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 5f44b4c26fe..579172515df 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -10542,7 +10542,10 @@ package body Sem_Util is
H := High_Bound (Range_Expression (Constraint (N)));
end if;
- elsif Is_Entity_Name (N) and then Is_Type (Entity (N)) then
+ elsif Is_Entity_Name (N)
+ and then Present (Entity (N))
+ and then Is_Type (Entity (N))
+ then
Rng := Scalar_Range_Of_Type (Entity (N));
if Error_Posted (Rng) then
--
2.43.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-05-13 8:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-13 8:35 [COMMITTED] ada: Avoid crash on illegal constrained type declarations Marc Poulhiès
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).