aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2017-09-08 13:41:58 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2017-09-08 15:41:58 +0200
commit410abeeb0dde4aa71e47a507aa517ff4a4dbb6a1 (patch)
tree7971c24d0eff4082a18f211748ca528f27085134
parent333e4f86e84ad505c372908d169c11032ba5641d (diff)
downloadgcc-410abeeb0dde4aa71e47a507aa517ff4a4dbb6a1.zip
gcc-410abeeb0dde4aa71e47a507aa517ff4a4dbb6a1.tar.gz
gcc-410abeeb0dde4aa71e47a507aa517ff4a4dbb6a1.tar.bz2
exp_aggr.adb: (Aggr_Assignment_OK_For_Backend): Add early return for access types.
2017-09-08 Eric Botcazou <ebotcazou@adacore.com> * exp_aggr.adb: (Aggr_Assignment_OK_For_Backend): Add early return for access types. From-SVN: r251896
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/exp_aggr.adb28
2 files changed, 27 insertions, 6 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 784d879..2302293 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2017-09-08 Eric Botcazou <ebotcazou@adacore.com>
+
+ * exp_aggr.adb: (Aggr_Assignment_OK_For_Backend): Add early return for
+ access types.
+
2017-09-08 Bob Duff <duff@adacore.com>
* par-prag.adb, sem_prag.adb, snames.ads-tmpl: Implement pragma
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 04fa866..2fa0dc5 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -4971,16 +4971,32 @@ package body Exp_Aggr is
return False;
end if;
- -- All elementary types are supported except for fat pointers
- -- because they are not really elementary for the backend.
+ -- All elementary types are supported
- if not Is_Elementary_Type (Ctyp)
- or else (Is_Access_Type (Ctyp)
- and then Esize (Ctyp) /= System_Address_Size)
- then
+ if not Is_Elementary_Type (Ctyp) then
return False;
end if;
+ -- However access types need to be dealt with specially
+
+ if Is_Access_Type (Ctyp) then
+
+ -- Fat pointers are rejected as they are not really elementary
+ -- for the backend.
+
+ if Esize (Ctyp) /= System_Address_Size then
+ return False;
+ end if;
+
+ -- The supported expressions are NULL and constants, others are
+ -- rejected upfront to avoid being analyzed below, which can be
+ -- problematic for some of them, for example allocators.
+
+ if Nkind (Expr) /= N_Null and then not Is_Entity_Name (Expr) then
+ return False;
+ end if;
+ end if;
+
-- The expression needs to be analyzed if True is returned
Analyze_And_Resolve (Expr, Ctyp);