aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2018-10-09 15:05:24 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-10-09 15:05:24 +0000
commite7e72f9b7a03cc9756ee5bff4c1b39a226228222 (patch)
tree7e026190176104b876c652366d5fa46ad5072d29 /gcc
parent96d268c284c3584a743bb679f06bf3e2bf36b3ed (diff)
downloadgcc-e7e72f9b7a03cc9756ee5bff4c1b39a226228222.zip
gcc-e7e72f9b7a03cc9756ee5bff4c1b39a226228222.tar.gz
gcc-e7e72f9b7a03cc9756ee5bff4c1b39a226228222.tar.bz2
[Ada] Spurious error message on visibiliy change in aspect expression
This patch removes an improper error message on a visibility change in an aspect expression between the freeze point and the end of the declaration list, when the expression involves a call to a instance of Unchecked_Conversion and the enclosing package declaration has a package body with multiple subprogram bodies. The following must compile quietly: ---- package body Par.Rep is procedure Nothing is begin null; end; procedure Rien is begin null; end; end; ---- with Par.Loc; package Par.Rep is type Rec is record X, Y : Integer; end record with Volatile; Thing2 : Unsigned_32 := 15; Thing3 : Rec with Volatile, Address => To_Address (Par.Loc.Flash_Base); procedure Nothing; end; ---- pragma Restrictions (No_Elaboration_Code); with interfaces; use interfaces; pragma unreferenced (interfaces); with Tp; use Tp; pragma unreferenced (Tp); package Par is end Par; ---- with Ada.Unchecked_Conversion; with System; with Interfaces; use Interfaces; package Tp is subtype system_address is unsigned_32; function to_address is new ada.unchecked_conversion (system_address, system.address); function To_32 is new ada.unchecked_conversion (System.Address, System_Address); end; ---- with TP; use TP; package Par.Loc is FLASH_BASE : constant system_address := 16#0800_0000#; end; 2018-10-09 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_ch6.adb (Fully_Conformant_Expressions): Handle properly the conformance check on an aspect expression that includes a call to an instance of Unchecked_Conversion, or more generally a call to an intrinsic operation. From-SVN: r264966
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/sem_ch6.adb12
2 files changed, 18 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index ccd9f16..e7ce7ee 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,10 @@
+2018-10-09 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch6.adb (Fully_Conformant_Expressions): Handle properly
+ the conformance check on an aspect expression that includes a
+ call to an instance of Unchecked_Conversion, or more generally a
+ call to an intrinsic operation.
+
2018-10-09 Eric Botcazou <ebotcazou@adacore.com>
* repinfo.adb: Remove with/use clause for Stand.
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index d0617fe..166987a 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -8932,7 +8932,17 @@ package body Sem_Ch6 is
or else
(Chars (Entity (E1)) = Chars (Entity (E2))
and then Ekind (Entity (E1)) = E_Loop_Parameter
- and then Ekind (Entity (E2)) = E_Loop_Parameter);
+ and then Ekind (Entity (E2)) = E_Loop_Parameter)
+
+ -- A call to an instantiation of Unchecked_Conversion is
+ -- rewritten with the name of the generated function
+ -- created for the instance, and this must be special-cased.
+
+ or else
+ (Ekind (Entity (E1)) = E_Function
+ and then Is_Intrinsic_Subprogram (Entity (E1))
+ and then Is_Generic_Instance (Entity (E1))
+ and then Entity (E2) = Alias (Entity (E1)));
elsif Nkind (E1) = N_Expanded_Name
and then Nkind (E2) = N_Expanded_Name