tree.c (append_random_chars): Generate the random characters in a reproducable fashion.
authorJohn Wehle <john@feith.com>
Fri, 14 Sep 2001 17:56:47 +0000 (17:56 +0000)
committerJohn Wehle <wehle@gcc.gnu.org>
Fri, 14 Sep 2001 17:56:47 +0000 (17:56 +0000)
* tree.c (append_random_chars): Generate the random
characters in a reproducable fashion.

From-SVN: r45606

gcc/ChangeLog
gcc/tree.c

index 390310d6a5f97f3244d1f6bf008ab35c58593d90..281a4eed8d4f438c9de05b508903d91a7c98d573 100644 (file)
@@ -1,3 +1,8 @@
+Fri Sep 14 13:54:50 EDT 2001  John Wehle  (john@feith.com)
+
+       * tree.c (append_random_chars): Generate the random
+       characters in a reproducable fashion.
+
 2001-09-14  Richard Henderson  <rth@redhat.com>
 
        * config/i386/i386.c (internal_label_prefix): New.
index d3db28978c52bcbf122da3896488ed7c97354b50..14d48071198502b57cf1063e5011751aa52f5289 100644 (file)
@@ -4533,19 +4533,21 @@ append_random_chars (template)
   static unsigned HOST_WIDE_INT value;
   unsigned HOST_WIDE_INT v;
 
-#ifdef HAVE_GETTIMEOFDAY
-  struct timeval tv;
-#endif
+  if (! value)
+    {
+      struct stat st;
 
-  template += strlen (template);
+      /* VALUE should be unique for each file and must
+        not change between compiles since this can cause
+        bootstrap comparison errors.  */
 
-#ifdef HAVE_GETTIMEOFDAY
-  /* Get some more or less random data.  */
-  gettimeofday (&tv, NULL);
-  value += ((unsigned HOST_WIDE_INT) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid ();
-#else
-  value += getpid ();
-#endif
+      if (stat (main_input_filename, &st) < 0)
+       abort ();
+
+      value = st.st_dev ^ st.st_ino ^ st.st_mtime;
+    }
+
+  template += strlen (template);
 
   v = value;