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] Illegal forward reference in pragma Postcondition


This patch ensures that the boolean expression of pragma Postcondition is
preanalyzed at the point of declaration when the pragma appears inside a
subprogram body.

------------
-- Source --
------------

--  main.adb

procedure Main is
   pragma Postcondition (X'Old = 1);
   X : Integer := 0;
begin
   X := 2;
end Main;

-----------------
-- Compilation --
-----------------

$ gcc -c -gnata main.adb
main.adb:2:26: "X" is undefined

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

2013-01-02  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_attr.adb (Analyze_Attribute): Skip the special _Parent
	scope generated for subprogram inlining purposes while trying
	to locate the enclosing function.
	* sem_prag.adb (Analyze_Pragma): Preanalyze the boolean
	expression of pragma Postcondition when the pragma comes from
	source and appears inside a subprogram body.

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]