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] Elaborate Secondary_Stack early


This patch fixes an obscure bug that causes the secondary stack to be used
before it is initialized in certain cases. This can only happen if (1) the
-gnatE switch is used to disable the static elaboration mode, (2) the -p
switch is passed to gnatbind to tell it to choose a pessimistic (worst-case)
elaboration order, and (3) gnatbind happens to choose an order in which the
body of System.Tasking.Protected_Objects is elaborated before the body of
System.Secondary_Stack.

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

2014-06-13  Bob Duff  <duff@adacore.com>

	* s-solita.adb (Get_Sec_Stack_Addr, Init_Tasking_Soft_Links):
	Add assertions requiring the secondary stack to be initialized.
	* s-solita.ads (Init_Tasking_Soft_Links): Comment.
	* s-taprob.adb, s-tarest.adb, s-tasini.adb (elab code): Make sure the
	secondary stack is initialized before calling Init_Tasking_Soft_Links,
	by adding pragmas Elaborate_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]