* [Ada] Spurious error -- "allocation from empty storage pool"
@ 2018-07-31 9:55 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2018-07-31 9:55 UTC (permalink / raw)
To: gcc-patches; +Cc: Bob Duff
[-- Attachment #1: Type: text/plain, Size: 518 bytes --]
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 <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.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 783 bytes --]
--- gcc/ada/sem_res.adb
+++ 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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-07-31 9:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-31 9:55 [Ada] Spurious error -- "allocation from empty storage pool" Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).