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] |
This patch adds a warning to a barrier function in an entry body, when the barrier mentions data that is not private to the protected object, and subject to external modification by unsynchronized actions, which can lead to hard-to- diagnose race conditions. Compiling entry_with_global_barrier.adb must yield entry_with_global_barrier.adb:39:49: warning: potentially unsynchronized barrier entry_with_global_barrier.adb:39:49: warning: "Global_Flag" should be private component of type with Ada.Text_IO; use Ada.Text_IO; procedure Entry_with_global_barrier is Global_Flag : Boolean := False; protected Triggered_from_Outside is entry Block_until_External_Condition; private Some_Flag : Boolean := False; end Triggered_from_Outside; protected body Triggered_from_Outside is entry Block_until_External_Condition when Global_Flag is begin Put_Line ("Barrier opened"); end Block_until_External_Condition; end Triggered_from_Outside; task Block; task body Block is begin Triggered_from_Outside.Block_until_External_Condition; Put_Line ("Block task terminates"); end Block; begin Global_Flag := True; Put_Line ("Main task waits for termination"); end Entry_with_global_barrier; Tested on x86_64-pc-linux-gnu, committed on trunk 2014-01-31 Ed Schonberg <schonberg@adacore.com> * exp_ch9.adb (Expand_Entry_Barrier): Warn if the barrier depends on data that is not private to the protected object, and potentially modifiable in unsynchronized fashion.
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] |