diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2020-05-30 11:14:12 +0200 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-17 13:17:14 -0300 |
commit | 7a615d2ee5a626fbd6e0829e4e1d591ba49bab28 (patch) | |
tree | 397b247605052d2987fc862b7d47ce29903f7b76 | |
parent | 927edc010e1eea65286aa9763c53120a723ad81e (diff) | |
download | gcc-7a615d2ee5a626fbd6e0829e4e1d591ba49bab28.zip gcc-7a615d2ee5a626fbd6e0829e4e1d591ba49bab28.tar.gz gcc-7a615d2ee5a626fbd6e0829e4e1d591ba49bab28.tar.bz2 |
[Ada] Add warning for overlays changing scalar storage order
gcc/ada/
* sem_ch13.adb (Analyze_Attribute_Definition_Clause) <Address>:
Issue an unconditional warning for an overlay that changes the
scalar storage order.
-rw-r--r-- | gcc/ada/sem_ch13.adb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index bad6a96..4bdd2cf 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -6075,10 +6075,10 @@ package body Sem_Ch13 is (N, U_Ent, No_Uint, O_Ent, Off); end if; - -- If the overlay changes the storage order, mark the - -- entity as being volatile to block any optimization - -- for it since the construct is not really supported - -- by the back end. + -- If the overlay changes the storage order, warn since + -- the construct is not really supported by the back end. + -- Also mark the entity as being volatile to block the + -- optimizer, even if there is no warranty on the result. if (Is_Record_Type (Etype (U_Ent)) or else Is_Array_Type (Etype (U_Ent))) @@ -6087,6 +6087,8 @@ package body Sem_Ch13 is and then Reverse_Storage_Order (Etype (U_Ent)) /= Reverse_Storage_Order (Etype (O_Ent)) then + Error_Msg_N + ("??overlay changes scalar storage order", Expr); Set_Treat_As_Volatile (U_Ent); end if; |