From 87ae0c74eb1e515d6d7c97892fdcaf11db61dea4 Mon Sep 17 00:00:00 2001
From: Greg McGary <greg@mcgary.org>
Date: Thu, 24 Aug 2000 20:04:10 +0000
Subject: [PATCH] cppfiles.c (actual_directory): Don't write beyond `dir' when
 it contains "".

	* cppfiles.c (actual_directory): Don't write beyond `dir'
	when it contains "".
	* real.c (asctoeg): Stay within bounds of etens[][].

From-SVN: r35944
---
 gcc/ChangeLog  |  6 ++++++
 gcc/cppfiles.c |  4 ++--
 gcc/real.c     | 10 +++++-----
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e9025fd8d8b5..2d10fb5d1ea5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2000-08-24  Greg McGary  <greg@mcgary.org>
+
+	* cppfiles.c (actual_directory): Don't write beyond `dir'
+	when it contains "".
+	* real.c (asctoeg): Stay within bounds of etens[][].
+
 2000-08-24  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
 	* dependence.c (dependence_string, direction_string,
diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c
index 2a8f01c38353..2078989a62c4 100644
--- a/gcc/cppfiles.c
+++ b/gcc/cppfiles.c
@@ -1041,8 +1041,8 @@ actual_directory (pfile, fname)
     }
   else
     {
-      dir[0] = '.';
-      dir[1] = '\0';
+      free (dir);
+      dir = xstrdup (".");
       dlen = 1;
     }
 
diff --git a/gcc/real.c b/gcc/real.c
index eb8736c72cdd..6c09f753ce92 100644
--- a/gcc/real.c
+++ b/gcc/real.c
@@ -5132,9 +5132,9 @@ asctoeg (ss, y, oprec)
 {
   unsigned EMUSHORT yy[NI], xt[NI], tt[NI];
   int esign, decflg, sgnflg, nexp, exp, prec, lost;
-  int k, trail, c, rndsav;
+  int i, k, trail, c, rndsav;
   EMULONG lexp;
-  unsigned EMUSHORT nsign, *p;
+  unsigned EMUSHORT nsign;
   char *sp, *s, *lstr;
   int base = 10;
 
@@ -5418,14 +5418,14 @@ read_expnt:
 	  nexp -= 4096;
 	}
     }
-  p = &etens[NTEN][0];
   emov (eone, xt);
   exp = 1;
+  i = NTEN;
   do
     {
       if (exp & nexp)
-	emul (p, xt, xt);
-      p -= NE;
+	emul (etens[i], xt, xt);
+      i--;
       exp = exp + exp;
     }
   while (exp <= MAXP);
-- 
GitLab