[Ada] Fix Is_Volatile_Function for functions declared in protected bodies

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

Function declared immediately within a protected body is a not a
protected function; the exact definition is RM 9.5.1(1): "A protected
subprogram is a subprogram declared immediately within a protected

Consequently, functions declared immediately within a protected body are
not volatile.

This fix primarily affects SPARK legality checking; for compilation it
only affects a warning about infinite loops.

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


	* sem_util.adb (Is_Volatile_Function): Follow the exact wording
	of SPARK (regarding volatile functions) and Ada (regarding
	protected functions).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 624 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210616/acd6c0b4/attachment-0001.bin>

More information about the Gcc-patches mailing list