summaryrefslogtreecommitdiff
path: root/gcc/ada/checks.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-27 12:29:32 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-27 12:29:32 +0000
commit1d90d657c0f9fa2f866405d6f2c00087e4136f88 (patch)
tree34813e768b591df62c5467dd0344b9df257802ba /gcc/ada/checks.adb
parent893604f08ab37ffbd4c82a259c0f2ba5cd7c0547 (diff)
downloadgcc-1d90d657c0f9fa2f866405d6f2c00087e4136f88.tar.gz
2004-10-26 Ed Schonberg <schonberg@gnat.com>
* checks.adb (Expr_Known_Valid): If floating-point validity checks are enabled, check the result of unary and binary operations when the expression is the right-hand side of an assignment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89645 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/checks.adb')
-rw-r--r--gcc/ada/checks.adb23
1 files changed, 18 insertions, 5 deletions
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index 357d9f290ec..a60b21d4ae4 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -3792,13 +3792,26 @@ package body Checks is
-- The result of any function call or operator is always considered
-- valid, since we assume the necessary checks are done by the call.
+ -- For operators on floating-point operations, we must also check
+ -- when the operation is the right-hand side of an assignment, or
+ -- is an actual in a call.
- elsif Nkind (Expr) in N_Binary_Op
- or else
- Nkind (Expr) in N_Unary_Op
- or else
- Nkind (Expr) = N_Function_Call
+ elsif
+ Nkind (Expr) in N_Binary_Op or else Nkind (Expr) in N_Unary_Op
then
+ if Is_Floating_Point_Type (Typ)
+ and then Validity_Check_Floating_Point
+ and then
+ (Nkind (Parent (Expr)) = N_Assignment_Statement
+ or else Nkind (Parent (Expr)) = N_Function_Call
+ or else Nkind (Parent (Expr)) = N_Parameter_Association)
+ then
+ return False;
+ else
+ return True;
+ end if;
+
+ elsif Nkind (Expr) = N_Function_Call then
return True;
-- For all other cases, we do not know the expression is valid