From de12d07e93ca47cacbbeda1107e7cc3b6af9ad63 Mon Sep 17 00:00:00 2001 From: Yannick Moy Date: Fri, 13 Dec 2019 09:04:58 +0000 Subject: [PATCH] [Ada] Avoid spurious mismatch error of assertion policy in generics 2019-12-13 Yannick Moy gcc/ada/ * sem_util.adb (Original_Aspect_Pragma_Name): Go through Original_Node for pragma. From-SVN: r279359 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/sem_util.adb | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 9af0c438509..3ec76a28f30 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2019-12-13 Yannick Moy + + * sem_util.adb (Original_Aspect_Pragma_Name): Go through + Original_Node for pragma. + 2019-12-13 Piotr Trojanek * exp_aggr.adb, exp_unst.adb: Minor fix typo in comment. diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 03ce7c0327a..e29360f576f 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -23326,13 +23326,16 @@ package body Sem_Util is Item := Corresponding_Aspect (Item); end if; - -- Retrieve the name of the aspect/pragma. Note that Pre, Pre_Class, + -- Retrieve the name of the aspect/pragma. As assertion pragmas from + -- a generic instantiation might have been rewritten into pragma Check, + -- we look at the original node for Item. Note also that Pre, Pre_Class, -- Post and Post_Class rewrite their pragma identifier to preserve the - -- original name. + -- original name, so we look at the original node for the identifier. -- ??? this is kludgey if Nkind (Item) = N_Pragma then - Item_Nam := Chars (Original_Node (Pragma_Identifier (Item))); + Item_Nam := + Chars (Original_Node (Pragma_Identifier (Original_Node (Item)))); else pragma Assert (Nkind (Item) = N_Aspect_Specification); -- 2.30.2