This is the mail archive of the
mailing list for the GCC project.
[Ada] Spurious error -- "allocation from empty storage pool"
- From: Pierre-Marie de Rodat <derodat at adacore dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Bob Duff <duff at adacore dot com>
- Date: Tue, 31 Jul 2018 05:55:28 -0400
- Subject: [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.
Tested on x86_64-pc-linux-gnu, committed on trunk
2018-07-31 Bob Duff <email@example.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.
@@ -5035,9 +5035,14 @@ package body Sem_Res is
- -- 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)
Error_Msg_N ("allocation from empty storage pool!", N);
-- If the context is an unchecked conversion, as may happen within an