summaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch13.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-23 06:39:36 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-23 06:39:36 +0000
commit843022ddef2fa6b556a8e2f57c33308d47621073 (patch)
treec4111d0cf04a3fbaafe28dc59388d2a63c26f0ad /gcc/ada/exp_ch13.adb
parentc7de76b3067121d171bb0bb94d5c2fb7c3597d52 (diff)
downloadgcc-843022ddef2fa6b556a8e2f57c33308d47621073.tar.gz
2010-06-23 Robert Dewar <dewar@adacore.com>
* freeze.adb: Minor reformatting. 2010-06-23 Bob Duff <duff@adacore.com> * g-pehage.adb (Trim_Trailing_Nuls): Fix the code to match the comment. 2010-06-23 Vincent Celier <celier@adacore.com> * make.adb (Compile_Sources): Complete previous change. 2010-06-23 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Add_Extra_Formal): Use suffix "C" in the name of the Constrained extra formal. 2010-06-23 Ed Schonberg <schonberg@adacore.com> * exp_ch13.adb (Expand_Freeze_Actions): If validity checks and Initialize_Scalars are enabled, compile the generated equality function for a composite type with full checks enabled, so that validity checks are performed on individual components. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161250 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_ch13.adb')
-rw-r--r--gcc/ada/exp_ch13.adb21
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/ada/exp_ch13.adb b/gcc/ada/exp_ch13.adb
index 3b682cf04ae..6633ffb48f5 100644
--- a/gcc/ada/exp_ch13.adb
+++ b/gcc/ada/exp_ch13.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -46,6 +46,7 @@ with Snames; use Snames;
with Stand; use Stand;
with Tbuild; use Tbuild;
with Uintp; use Uintp;
+with Validsw; use Validsw;
package body Exp_Ch13 is
@@ -346,6 +347,24 @@ package body Exp_Ch13 is
Analyze (Decl, Suppress => All_Checks);
Pop_Scope;
+ -- We treat generated equality specially, if validity checks are
+ -- enabled, in order to detect components default-initialized
+ -- with invalid values.
+
+ elsif Nkind (Decl) = N_Subprogram_Body
+ and then Chars (Defining_Entity (Decl)) = Name_Op_Eq
+ and then Validity_Checks_On
+ and then Initialize_Scalars
+ then
+ declare
+ Save_Force : constant Boolean := Force_Validity_Checks;
+
+ begin
+ Force_Validity_Checks := True;
+ Analyze (Decl);
+ Force_Validity_Checks := Save_Force;
+ end;
+
else
Analyze (Decl, Suppress => All_Checks);
end if;