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] Element allocators in indefinite containers need accessibility checks


Various operations in the indefinite containers perform initialized allocators
for elements, and accessibility checks are required on those allocators which
can fail when the actual type for Element_Type is a class-wide type and the
operation is passed an element value of a type extension declared at a deeper
level than the container instantiation (violating the check in 4.8(10.1)).
Like other units in the GNAT library, the containers (and their instances)
are compiled with checks suppressed, so the needed accessibility checks are
not performed, which can result in accesses to dispatch tables that have gone
out of scope. A similar problem can occur for element types with access
discriminants. This is corrected by applying pragma Unsuppress in the various
container operations that have allocators initialized by Element_Type formals.
Note that AI12-0035 has been created to address the gap in the language rules,
since these checks should be required.

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

2012-07-23  Gary Dismukes  <dismukes@adacore.com>

	* a-cihama.adb, a-cihase.adb, a-cimutr.adb, a-ciorma.adb, a-ciormu.adb,
	a-ciorse.adb, a-coinho.adb, a-coinve.adb, a-cidlli.adb: Unsuppress
	Accessibility_Check for Element_Type allocators.

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]