summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2017-09-08 13:41:58 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2017-09-08 13:41:58 +0000
commitfb03fb96d968a90ac8e1e3c66f197249b637fca4 (patch)
tree7971c24d0eff4082a18f211748ca528f27085134
parenta34991130afea7c8446f76c8b9eb75e9f9794e8f (diff)
downloadgcc-fb03fb96d968a90ac8e1e3c66f197249b637fca4.tar.gz
2017-09-08 Eric Botcazou <ebotcazou@adacore.com>
* exp_aggr.adb: (Aggr_Assignment_OK_For_Backend): Add early return for access types. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@251896 138bc75d-0d04-0410-961f-82ee72b054a4
-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 784d87936dd..2302293f545 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 04fa866b73b..2fa0dc52b7a 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);