summaryrefslogtreecommitdiff
path: root/gcc/ada/namet.ads
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-21 16:33:09 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-21 16:33:09 +0000
commit7c80da6e3b28b685078014216cac0c43295503fc (patch)
treef6613c9cb7abf86dd60c46c21622ad75ef34fe4b /gcc/ada/namet.ads
parent5bf271d8af82cffe7b2d01e28263f3a3158081f3 (diff)
downloadgcc-7c80da6e3b28b685078014216cac0c43295503fc.tar.gz
2014-01-21 Robert Dewar <dewar@adacore.com>
* par-ch4.adb (P_If_Expression): Rewritten to improve error recovery. * par-ch5.adb (P_Condition): New version with expression prescanned. * par.adb (P_Condition): New version with expression prescanned. 2014-01-21 Robert Dewar <dewar@adacore.com> * gnat_rm.texi: Document that Allow_Integer_Address is ignored if Address is not a private type. * sem_prag.adb (Analyze_Pragma, case Allow_Integer_Address): Ignore pragma if System.Address is not a private type. 2014-01-21 Arnaud Charlet <charlet@adacore.com> * namet.ads (Name_Len): Initialize to 0 to avoid accessing an uninitialized value. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206892 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/namet.ads')
-rw-r--r--gcc/ada/namet.ads8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ada/namet.ads b/gcc/ada/namet.ads
index dcce9ea91c9..4c9fc77bf78 100644
--- a/gcc/ada/namet.ads
+++ b/gcc/ada/namet.ads
@@ -130,9 +130,15 @@ package Namet is
-- The limit here is intended to be an infinite value that ensures that we
-- never overflow the buffer (names this long are too absurd to worry!)
- Name_Len : Natural;
+ Name_Len : Natural := 0;
-- Length of name stored in Name_Buffer. Used as an input parameter for
-- Name_Find, and as an output value by Get_Name_String, or Write_Name.
+ -- Note: in normal usage, all users of Name_Buffer/Name_Len are expected
+ -- to initialize Name_Len appropriately. The reason we preinitialize to
+ -- zero here is that some circuitry (e.g. Osint.Write_Program_Name) does
+ -- a save/restore on Name_Len and Name_Buffer (1 .. Name_Len), and we do
+ -- not want some arbitrary junk value to result in saving an arbitrarily
+ -- long slice which would waste time and blow the stack.
-----------------------------
-- Types for Namet Package --