Fix a potential core dump when merging aliases. Might fix bug #15818.
authorPaul Smith <psmith@gnu.org>
Tue, 21 Feb 2006 05:21:19 +0000 (05:21 +0000)
committerPaul Smith <psmith@gnu.org>
Tue, 21 Feb 2006 05:21:19 +0000 (05:21 +0000)
Revert intermediate file free code.
Suppress some warnings in VMS builds.

ChangeLog
implicit.c
makefile.vms
variable.c

index 969df369bca47b86334f75d66a5896fb9b714460..b2cde4fe5cab8ab01a4b2aa209d729fb6c880c93 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-02-20  Paul D. Smith  <psmith@gnu.org>
+
+       * variable.c (merge_variable_set_lists): It's legal for *setlist0
+       to be null; don't core in that case.
+
 2006-02-19  Paul D. Smith  <psmith@gnu.org>
 
        * commands.c (set_file_variables): Realloc, not malloc, the static
index 054b71a50d098124529c585900ce3a45cbe104bd..b8f1054c91ae2104be479238a40e67d76880aaf4 100644 (file)
@@ -80,19 +80,21 @@ static void
 free_idep_chain (struct idep *p)
 {
   struct idep *n;
-  struct file *f;
 
   for (; p != 0; p = n)
     {
       n = p->next;
 
       if (p->name)
-        free (p->name);
+        {
+          struct file *f = p->intermediate_file;
+
+          if (f != 0
+              && (f->stem < f->name || f->stem > f->name + strlen (f->name)))
+            free (f->stem);
 
-      f = p->intermediate_file;
-      if (f != 0
-          && (f->stem < f->name || f->stem > f->name + strlen (f->name)))
-        free (f->stem);
+          free (p->name);
+        }
 
       free (p);
     }
@@ -836,7 +838,7 @@ pattern_search (struct file *file, int archive,
 
          f->deps = imf->deps;
          f->cmds = imf->cmds;
-         f->stem = xstrdup (imf->stem);
+         f->stem = imf->stem;
           f->also_make = imf->also_make;
           f->is_target = 1;
 
index 2fd2b8960cfcccfa8ff7c6d9c4331c543c480e65..3b956a4e88892613892f28c6a8a7de6b6fc93280 100644 (file)
@@ -32,7 +32,7 @@ CP = copy
 #
 
 ifeq ($(CC),cc)
-CFLAGS = $(defines) /include=([],[.glob])/prefix=(all,except=(glob,globfree))/standard=relaxed
+CFLAGS = $(defines) /include=([],[.glob])/prefix=(all,except=(glob,globfree))/standard=relaxed/warn=(disable=questcompare)
 else
 CFLAGS = $(defines) /include=([],[.glob])
 endif
index 39f0adaa2bd6b52adbad898ab392f8a8d1207ad4..54bbc02ae53f2a7304a9fdabd476746dbc276113 100644 (file)
@@ -674,16 +674,17 @@ merge_variable_set_lists (struct variable_set_list **setlist0,
 
   /* This loop relies on the fact that all setlists terminate with the global
      setlist (before NULL).  If that's not true, arguably we SHOULD die.  */
-  while (setlist1 != &global_setlist && to != &global_setlist)
-    {
-      struct variable_set_list *from = setlist1;
-      setlist1 = setlist1->next;
+  if (to)
+    while (setlist1 != &global_setlist && to != &global_setlist)
+      {
+        struct variable_set_list *from = setlist1;
+        setlist1 = setlist1->next;
 
-      merge_variable_sets (to->set, from->set);
+        merge_variable_sets (to->set, from->set);
 
-      last0 = to;
-      to = to->next;
-    }
+        last0 = to;
+        to = to->next;
+      }
 
   if (setlist1 != &global_setlist)
     {