[Ada] Factor out machine rounding operations

Pierre-Marie de Rodat derodat@adacore.com
Wed Oct 20 19:27:53 GMT 2021


The RM 4.9(38/2) clause specifies that the rounding to be applied to a
real static expression that is not part of a larger static expression
is implementation defined, so it makes sense to have a single function
implementing the operation.  The change also sets the Is_Machine_Number
flag more consistently.  No functional changes.

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

gcc/ada/

	* sem_eval.ads (Machine_Number): New inline function.
	* sem_eval.adb (Machine_Number): New function body implementing
	the machine rounding operation specified by RM 4.9(38/2).
	(Check_Non_Static_Context): Call Machine_Number and set the
	Is_Machine_Number flag consistently on the resulting node.
	* sem_attr.adb (Eval_Attribute) <Attribute_Machine>: Likewise.
	* checks.adb (Apply_Float_Conversion_Check): Call Machine_Number.
	(Round_Machine): Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 5615 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20211020/6a4550f4/attachment.bin>


More information about the Gcc-patches mailing list