This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Allocation from empty storage pool is error, not warning


Ada specifies that allocation from an empty storage pool (one for which
a static storage size of zero was given) is an error, but previously we
were just generating a warning. This patch corrects that oversight.

The following shows the new error message (compiled with -gnat05)

     1. procedure BadUCnew is
     2.    type R is access all integer;
     3.    for R'Storage_Size use 0;
     4.    RR : R;
     5. begin
     6.    RR := new Integer'(3);
                 |
        >>> allocation from empty storage pool

     7. end;

Note: the patch restricts these messages to static expressions with a
value of zero to correspond exactly to the language rules.

Tested on x86_64-pc-linux-gnu, committed on trunk

2010-10-07  Robert Dewar  <dewar@adacore.com>

	* einfo.ads (No_Pool_Assigned): Update documentation.
	* sem_ch13.adb (Analyze_Attribute_Definition_Clause, case
	Storage_Size): We only set No_Pool_Assigned if the expression is a
	static constant and zero.
	* sem_res.adb (Resolve_Allocator): Allocation from empty storage pool
	should be an error not a warning.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]