From 8d9cf0a3b3e5629be6ff87f0db8232867555ece8 Mon Sep 17 00:00:00 2001 From: Ed Schonberg Date: Thu, 12 Dec 2019 10:03:53 +0000 Subject: [PATCH] [Ada] Spurious warning about change of representastion in call 2019-12-12 Ed Schonberg gcc/ada/ * sem_ch13.adb (Same_Reprewentation): if the actual in a call is a generic actual type, use its bsae type to determine whether a change of representastion may be necessary for proper parameter passing. From-SVN: r279305 --- gcc/ada/ChangeLog | 7 +++++++ gcc/ada/sem_ch13.adb | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index f18df828896..3423e2e83e2 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2019-12-12 Ed Schonberg + + * sem_ch13.adb (Same_Reprewentation): if the actual in a call is + a generic actual type, use its bsae type to determine whether a + change of representastion may be necessary for proper parameter + passing. + 2019-12-12 Ed Schonberg * sem_type.adb (Find_Unique_Type): A call to the universal diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 759b7ce0509..b6d970594e0 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -13448,6 +13448,14 @@ package body Sem_Ch13 is and then Base_Type (T1) = Full_View (Base_Type (T2)) then return True; + + -- If T2 is a generic actual it is declared as a subtype, so + -- check against its base type. + + elsif Is_Generic_Actual_Type (T1) + and then Same_Representation (Base_Type (T1), T2) + then + return True; end if; -- Tagged types always have the same representation, because it is not -- 2.30.2