[Ada] Fix missing range check for In/Out parameter with -gnatVa

Pierre-Marie de Rodat derodat@adacore.com
Mon Aug 12 09:10:00 GMT 2019


This plugs another small loophole in the front-end which fails to
generate a range check for a scalar In/Out parameter when -gnatVa is
specified.  This also fixes a few more leaks of the Do_Range_Check flag
on actual parameters, both in regular and -gnatVa modes, as well as a
leak specific to expression function in -gnatp mode.

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

2019-08-12  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* checks.adb (Insert_Valid_Check): Reset the Do_Range_Check flag
	on the validated object.
	* exp_ch6.adb (Add_Call_By_Copy_Code): Reset the Do_Range_Check
	flag on the actual here, as well as on the Expression if the
	actual is a N_Type_Conversion node.
	(Add_Validation_Call_By_Copy_Code): Generate the incoming range
	check if needed and reset the Do_Range_Check flag on the
	Expression if the actual is a N_Type_Conversion node.
	(Expand_Actuals): Do not reset the Do_Range_Check flag here.
	Generate the incoming range check for In parameters here instead
	of...
	(Expand_Call_Helper): ...here.  Remove redudant condition.
	* sem_res.adb (Resolve_Actuals): Use local variable A_Typ and
	remove obsolete comments.
	(Resolve_Type_Conversion): Do not force the Do_Range_Check flag
	on the operand if range checks are suppressed.

gcc/testsuite/

	* gnat.dg/range_check6.adb: New testcase.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 7568 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190812/ccd65f74/attachment.bin>


More information about the Gcc-patches mailing list