Commit ae3f6530 by Eric Botcazou Committed by Pierre-Marie de Rodat

[Ada] Sinfo: update doc about Do_Division/Overlflow/Range_Check

2019-07-22  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* sinfo.ads: Update the documentation about the
	Do_Division_Check, Do_Overflow_Check and Do_Range_Check flags.

From-SVN: r273696
parent 267c7ff6
2019-07-22 Eric Botcazou <ebotcazou@adacore.com> 2019-07-22 Eric Botcazou <ebotcazou@adacore.com>
* sinfo.ads: Update the documentation about the
Do_Division_Check, Do_Overflow_Check and Do_Range_Check flags.
2019-07-22 Eric Botcazou <ebotcazou@adacore.com>
* exp_ch4.adb (Expand_N_Type_Conversion): Beef up comment. * exp_ch4.adb (Expand_N_Type_Conversion): Beef up comment.
(Fixup_Universal_Fixed_Operation): Set the base type instead of (Fixup_Universal_Fixed_Operation): Set the base type instead of
the type of the enclosing type conversion on the operation. the type of the enclosing type conversion on the operation.
......
...@@ -755,14 +755,15 @@ package Sinfo is ...@@ -755,14 +755,15 @@ package Sinfo is
-- Do_Division_Check flag on float exponentiation expressions, for the case -- Do_Division_Check flag on float exponentiation expressions, for the case
-- where the value is 0.0 and the exponent is negative, although this case -- where the value is 0.0 and the exponent is negative, although this case
-- does lead to a division check failure. As another special case, -- does lead to a division check failure. As another special case,
-- the frontend does not insert a Do_Range_Check on an allocator where -- the front end does not insert a Do_Range_Check on an allocator where
-- the designated type is scalar, and the designated type is more -- the designated type is scalar, and the designated type is more
-- constrained than the type of the initialized allocator value or the type -- constrained than the type of the initialized allocator value or the type
-- of the default value for an uninitialized allocator. -- of the default value for an uninitialized allocator.
-- Note: the expander always takes care of the Do_Range check case, -- Note that the expander always takes care of the Do_Range_Check case, so
-- so this flag will never be set in the expanded tree passed to the -- this flag will never be set in the expanded tree passed to the back end.
-- back end code generator. -- For the other two flags, the check can be generated either by the back
-- end or by the front end, depending on the setting of a target parameter.
-- Note that this accounts for all nodes that trigger the corresponding -- Note that this accounts for all nodes that trigger the corresponding
-- checks, except for range checks on subtype_indications, which may be -- checks, except for range checks on subtype_indications, which may be
...@@ -1186,9 +1187,10 @@ package Sinfo is ...@@ -1186,9 +1187,10 @@ package Sinfo is
-- conversion nodes (and set if the conversion requires a check). -- conversion nodes (and set if the conversion requires a check).
-- Do_Division_Check (Flag13-Sem) -- Do_Division_Check (Flag13-Sem)
-- This flag is set on a division operator (/ mod rem) to indicate -- This flag is set on a division operator (/ mod rem) to indicate that
-- that a zero divide check is required. The actual check is dealt -- a zero divide check is required. The actual check is either dealt with
-- with by the backend (all the front end does is to set the flag). -- by the back end if Backend_Divide_Checks is set to true, or by the
-- front end itself if it is set to false.
-- Do_Length_Check (Flag4-Sem) -- Do_Length_Check (Flag4-Sem)
-- This flag is set in an N_Assignment_Statement, N_Op_And, N_Op_Or, -- This flag is set in an N_Assignment_Statement, N_Op_And, N_Op_Or,
...@@ -1197,15 +1199,13 @@ package Sinfo is ...@@ -1197,15 +1199,13 @@ package Sinfo is
-- Do_Overflow_Check (Flag17-Sem) -- Do_Overflow_Check (Flag17-Sem)
-- This flag is set on an operator where an overflow check is required on -- This flag is set on an operator where an overflow check is required on
-- the operation. The actual check is dealt with by the backend (all the -- the operation. The actual check is either dealt with by the back end
-- front end does is to set the flag). The other cases where this flag is -- if Backend_Overflow_Checks is set to true, or by the front end itself
-- used is on a Type_Conversion node and for attribute reference nodes. -- if it is set to false. The other cases where this flag is used is on a
-- Type_Conversion node as well on if and case expression nodes.
-- For a type conversion, it means that the conversion is from one base -- For a type conversion, it means that the conversion is from one base
-- type to another, and the value may not fit in the target base type. -- type to another, and the value may not fit in the target base type.
-- See also the description of Do_Range_Check for this case. The only -- See also the description of Do_Range_Check for this case. This flag is
-- attribute references which use this flag are Pred and Succ, where it
-- means that the result should be checked for going outside the base
-- range. Note that this flag is not set for modular types. This flag is
-- also set on if and case expression nodes if we are operating in either -- also set on if and case expression nodes if we are operating in either
-- MINIMIZED or ELIMINATED overflow checking mode (to make sure that we -- MINIMIZED or ELIMINATED overflow checking mode (to make sure that we
-- properly process overflow checking for dependent expressions). -- properly process overflow checking for dependent expressions).
...@@ -1215,9 +1215,9 @@ package Sinfo is ...@@ -1215,9 +1215,9 @@ package Sinfo is
-- range check is required. The target type is clear from the context. -- range check is required. The target type is clear from the context.
-- The contexts in which this flag can appear are the following: -- The contexts in which this flag can appear are the following:
-- Right side of an assignment. In this case the target type is -- Right side of an assignment. In this case the target type is taken
-- taken from the left side of the assignment, which is referenced -- from the left side of the assignment, which is referenced by the
-- by the Name of the N_Assignment_Statement node. -- Name of the N_Assignment_Statement node.
-- Subscript expressions in an indexed component. In this case the -- Subscript expressions in an indexed component. In this case the
-- target type is determined from the type of the array, which is -- target type is determined from the type of the array, which is
...@@ -1251,15 +1251,6 @@ package Sinfo is ...@@ -1251,15 +1251,6 @@ package Sinfo is
-- listed above (e.g. in a return statement), an additional type -- listed above (e.g. in a return statement), an additional type
-- conversion node is introduced to represent the required check. -- conversion node is introduced to represent the required check.
-- A special case arises for the arguments of the Pred/Succ attributes.
-- Here the range check needed is against First + 1 .. Last (Pred) or
-- First .. Last - 1 (Succ) of the corresponding base type. Essentially
-- these checks are what would be performed within the implicit body of
-- the functions that correspond to these attributes. In these cases,
-- the Do_Range check flag is set on the argument to the attribute
-- function, and the back end must special case the appropriate range
-- to check against.
-- Do_Storage_Check (Flag17-Sem) -- Do_Storage_Check (Flag17-Sem)
-- This flag is set in an N_Allocator node to indicate that a storage -- This flag is set in an N_Allocator node to indicate that a storage
-- check is required for the allocation, or in an N_Subprogram_Body node -- check is required for the allocation, or in an N_Subprogram_Body node
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment