This is the mail archive of the 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] Check for container tampering

There are several operations (e.g. Find) that call the generic operation for
element equality. In principle it is possible for the generic actual to tamper
with the elements of the container while the operation is in progress, but such
behavior would be undefined. AI05-0022 requires that the implementation detect
when container manipulation occurs through the equality operator, and to raise
Program_Error as necessary to prevent erroneous execution.

We do that here by incrementing the lock counters before entering the loop. If
tamper-sensitive operations are called while the loop is executing, the
non-zero lock count will be detected and Program_Error raised.

The text of AI05-0022 can be found here:

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

2013-04-11  Matthew Heaney  <>

	* a-convec.adb, a-coinve.adb, a-cobove.adb ("="): Increment lock
	counts before entering loop.
	(Find, Find_Index): Ditto.
	(Is_Sorted, Merge, Sort): Ditto.
	(Reverse_Find, Reverse_Find_Index): Ditto.

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]