public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-298] [Ada] fix crash on Secondary_Stack_Size with discriminant
@ 2022-05-11 8:55 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-11 8:55 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:6281d36342c29cdd9acb32032f59bf440953c942
commit r13-298-g6281d36342c29cdd9acb32032f59bf440953c942
Author: Bob Duff <duff@adacore.com>
Date: Fri Jan 28 14:40:27 2022 -0500
[Ada] fix crash on Secondary_Stack_Size with discriminant
This patch fixes a crash caused by specifying the Secondary_Stack_Size
aspect of a task type as the value of a discriminant of the task type,
and then declaring a record component whose type is the task type,
constrained to a discriminant of the record.
gcc/ada/
* sem_ch3.adb (Get_Discr_Value): Copy the result. Otherwise, the
"tree" can be malformed (a DAG, not a tree) because
Get_Discr_Value could be returning some subtree already attached
to the tree.
Diff:
---
gcc/ada/sem_ch3.adb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 53b0ec994c9..d4464e2b8c9 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -13963,7 +13963,7 @@ package body Sem_Ch3 is
or else D = CR_Discriminant (Discr_Id)
or else Corresponding_Discriminant (D) = Discr_Id
then
- return Node (E);
+ return New_Copy_Tree (Node (E));
end if;
Next_Discriminant (D);
@@ -13987,7 +13987,7 @@ package body Sem_Ch3 is
E := First_Elmt (Constraints);
while Present (D) loop
if D = Discr_Id then
- return Node (E);
+ return New_Copy_Tree (Node (E));
end if;
Next_Discriminant (D);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-05-11 8:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11 8:55 [gcc r13-298] [Ada] fix crash on Secondary_Stack_Size with discriminant Pierre-Marie de Rodat
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).