[Ada] Ignore volatile restrictions in preanalysis

Pierre-Marie de Rodat derodat@adacore.com
Wed Jun 16 08:43:56 GMT 2021

When detecting references to volatile objects in expressions of the
expression functions we couldn't determine the enclosing function. This
was because we examined a copy of the expression made for preanalysis
and this copy is not properly decorated. Consequently, we wrongly
rejected valid references like:

   Data : Integer
     with Atomic, Async_Readers => True, Async_Writers => True;

   function F return Integer is (Data) with Volatile_Function;

This patch effectively disables the detection of references to volatile
objects in preanalysis by assuming all such references to be legal.

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


	* sem_util.adb (Is_OK_Volatile_Context): All references to
	volatile objects are legal in preanalysis.
	(Within_Volatile_Function): Previously it was wrongly called on
	Empty entities; now it is only called on E_Return_Statement,
	which allow the body to be greatly simplified.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 2004 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210616/6ef87557/attachment-0001.bin>

More information about the Gcc-patches mailing list