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] Properly check No_Secondary_Stack restriction


This patch adds a missing check for violation of the restriction
No_Secondary_Stack. The following program should get the indicated
diagnostic when compiled.

Compiling: ch040303_02.adb

     1. package body Ch040303_02 is
     2.    function F1 (Last : Integer) return Arr is
     3.    begin
     4.       return (1 .. Last => 123);
              |
        >>> violation of restriction "No_Secondary_Stack"
            at ch040303_02.ads:1

     5.    end F1;
     6. end Ch040303_02;

Compiling: ch040303_02.ads

     1. pragma Restrictions (No_Secondary_Stack);
     2. package Ch040303_02 is
     3.    type Arr is array (Integer range <>) of Integer;
     4.    function F1 (Last : Integer) return Arr;
     5. end Ch040303_02;

 6 lines: 1 error

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

2008-08-04  Robert Dewar  <dewar@adacore.com>

	* exp_ch5.adb:
	(Expand_Simple_Function_Return): Check No_Secondary_Stack restriction
	at point of return.

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]