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] |
The compiler does not handle well the accessibility check of anonymous access types that are formals of anonymous access to subprogram components of record types. The execution of the program may crash or have unexpected behavior since the check is performed with an expected actual (the accessibility level) which is not passed by the caller. After this patch the following test executes without errors. with Text_IO; use Text_IO; procedure Cutdown is type Self_Ref; type Self_Ref is record Ptr : access procedure (X: access Self_Ref); end record; Ptr : access Self_Ref; procedure Foo (Xxx : access Self_Ref) is begin -- Accessibility check required for this assignment Ptr := Xxx; end Foo; procedure Nested is Yyy : aliased Self_Ref := (Ptr => Foo'Access); begin Yyy.Ptr.all (Yyy'Access); -- must raise PE Put_Line ("Test failed"); exception when Program_Error => null; end; begin Nested; end; Command: gnatmake -gnat05 cutdown.adb; ./cutdown Tested on x86_64-pc-linux-gnu, committed on trunk 2011-08-02 Javier Miranda <miranda@adacore.com> * sem_ch3.adb (Check_Anonymous_Access_Components): Create extra formals associated with anonymous access to subprograms.
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] |