aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBob Duff <duff@adacore.com>2018-07-31 09:55:11 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-07-31 09:55:11 +0000
commite78c79ff53c9370b5438d7f8b9f7096103ee0d44 (patch)
tree75802caed9b5edc54cd98f45ed61025710a597b2 /gcc
parent1102fd64dbb76784ed46ff81bf905f6c52d296fc (diff)
downloadgcc-e78c79ff53c9370b5438d7f8b9f7096103ee0d44.zip
gcc-e78c79ff53c9370b5438d7f8b9f7096103ee0d44.tar.gz
gcc-e78c79ff53c9370b5438d7f8b9f7096103ee0d44.tar.bz2
[Ada] Spurious error -- "allocation from empty storage pool"
This patch fixes a bug in which if "pragma Default_Storage_Pool (null);" is given, then a build-in-place function will get an incorrect error message "allocation from empty storage pool" even though there is no such allocation in the source program. 2018-07-31 Bob Duff <duff@adacore.com> gcc/ada/ * sem_res.adb (Resolve_Allocator): Do not complain about the implicit allocator that occurs in the expansion of a return statement for a build-in-place function. From-SVN: r263088
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/sem_res.adb9
2 files changed, 13 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 6f09626..d12064c 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2018-07-31 Bob Duff <duff@adacore.com>
+
+ * sem_res.adb (Resolve_Allocator): Do not complain about the
+ implicit allocator that occurs in the expansion of a return
+ statement for a build-in-place function.
+
2018-07-20 Martin Sebor <msebor@redhat.com>
PR middle-end/82063
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index b45e917..659b1ef 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -5035,9 +5035,14 @@ package body Sem_Res is
end;
end if;
- -- Check for allocation from an empty storage pool
+ -- Check for allocation from an empty storage pool. But do not complain
+ -- if it's a return statement for a build-in-place function, because the
+ -- allocator is there just in case the caller uses an allocator. If the
+ -- caller does use an allocator, it will be caught at the call site.
- if No_Pool_Assigned (Typ) then
+ if No_Pool_Assigned (Typ)
+ and then not Alloc_For_BIP_Return (N)
+ then
Error_Msg_N ("allocation from empty storage pool!", N);
-- If the context is an unchecked conversion, as may happen within an