Blame SOURCES/binutils-warnings.patch

7f163d
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
7f163d
index 6ecfab5d..f8698213 100644
7f163d
--- a/binutils/dwarf.c
7f163d
+++ b/binutils/dwarf.c
7f163d
@@ -4914,7 +4914,7 @@ display_debug_lines_decoded (struct dwarf_section *  section,
7f163d
 	      else
7f163d
 		{
7f163d
 		  newFileName = (char *) xmalloc (fileNameLength + 1);
7f163d
-		  strncpy (newFileName, fileName, fileNameLength + 1);
7f163d
+		  strcpy (newFileName, fileName);
7f163d
 		}
7f163d
 
7f163d
 	      if (!do_wide || (fileNameLength <= MAX_FILENAME_LENGTH))
7f163d
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
7f163d
index 3639bfbf..ed080a1a 100644
7f163d
--- a/libiberty/cp-demangle.c
7f163d
+++ b/libiberty/cp-demangle.c
7f163d
@@ -185,20 +185,6 @@ static void d_init_info (const char *, int, size_t, struct d_info *);
7f163d
 #define CP_STATIC_IF_GLIBCPP_V3
7f163d
 #endif /* ! defined(IN_GLIBCPP_V3) */
7f163d
 
7f163d
-/* See if the compiler supports dynamic arrays.  */
7f163d
-
7f163d
-#ifdef __GNUC__
7f163d
-#define CP_DYNAMIC_ARRAYS
7f163d
-#else
7f163d
-#ifdef __STDC__
7f163d
-#ifdef __STDC_VERSION__
7f163d
-#if __STDC_VERSION__ >= 199901L && !__STDC_NO_VLA__
7f163d
-#define CP_DYNAMIC_ARRAYS
7f163d
-#endif /* __STDC_VERSION__ >= 199901L && !__STDC_NO_VLA__ */
7f163d
-#endif /* defined (__STDC_VERSION__) */
7f163d
-#endif /* defined (__STDC__) */
7f163d
-#endif /* ! defined (__GNUC__) */
7f163d
-
7f163d
 /* We avoid pulling in the ctype tables, to prevent pulling in
7f163d
    additional unresolved symbols when this code is used in a library.
7f163d
    FIXME: Is this really a valid reason?  This comes from the original
7f163d
@@ -4343,29 +4329,21 @@ cplus_demangle_print_callback (int options,
7f163d
   d_print_init (&dpi, callback, opaque, dc);
7f163d
 
7f163d
   {
7f163d
-#ifdef CP_DYNAMIC_ARRAYS
7f163d
-    /* Avoid zero-length VLAs, which are prohibited by the C99 standard
7f163d
-       and flagged as errors by Address Sanitizer.  */
7f163d
-    __extension__ struct d_saved_scope scopes[(dpi.num_saved_scopes > 0)
7f163d
-                                              ? dpi.num_saved_scopes : 1];
7f163d
-    __extension__ struct d_print_template temps[(dpi.num_copy_templates > 0)
7f163d
-                                                ? dpi.num_copy_templates : 1];
7f163d
-
7f163d
-    dpi.saved_scopes = scopes;
7f163d
-    dpi.copy_templates = temps;
7f163d
-#else
7f163d
-    dpi.saved_scopes = alloca (dpi.num_saved_scopes
7f163d
-			       * sizeof (*dpi.saved_scopes));
7f163d
-    dpi.copy_templates = alloca (dpi.num_copy_templates
7f163d
-				 * sizeof (*dpi.copy_templates));
7f163d
-#endif
7f163d
-
7f163d
+    dpi.saved_scopes
7f163d
+      = (struct d_saved_scope *) xmalloc (dpi.num_saved_scopes
7f163d
+					  * sizeof (*dpi.saved_scopes));
7f163d
+    dpi.copy_templates
7f163d
+      = (struct d_print_template *) xmalloc (dpi.num_copy_templates
7f163d
+					     * sizeof (*dpi.copy_templates));
7f163d
     d_print_comp (&dpi, options, dc);
7f163d
   }
7f163d
 
7f163d
   d_print_flush (&dpi);
7f163d
 
7f163d
-  return ! d_print_saw_error (&dpi);
7f163d
+  int retval = ! d_print_saw_error (&dpi);
7f163d
+  free (dpi.saved_scopes);
7f163d
+  free (dpi.copy_templates);
7f163d
+  return retval;
7f163d
 }
7f163d
 
7f163d
 /* Turn components into a human readable string.  OPTIONS is the
7f163d
@@ -6307,16 +6285,12 @@ d_demangle_callback (const char *mangled, int options,
7f163d
     }
7f163d
 
7f163d
   {
7f163d
-#ifdef CP_DYNAMIC_ARRAYS
7f163d
-    __extension__ struct demangle_component comps[di.num_comps];
7f163d
-    __extension__ struct demangle_component *subs[di.num_subs];
7f163d
-
7f163d
-    di.comps = comps;
7f163d
-    di.subs = subs;
7f163d
-#else
7f163d
-    di.comps = alloca (di.num_comps * sizeof (*di.comps));
7f163d
-    di.subs = alloca (di.num_subs * sizeof (*di.subs));
7f163d
-#endif
7f163d
+    di.comps
7f163d
+      = (struct demangle_component *) xmalloc (di.num_comps
7f163d
+					       * sizeof (*di.comps));
7f163d
+    di.subs
7f163d
+      = (struct demangle_component **) xmalloc (di.num_subs
7f163d
+						* sizeof (*di.subs));
7f163d
 
7f163d
     switch (type)
7f163d
       {
7f163d
@@ -6357,6 +6331,8 @@ d_demangle_callback (const char *mangled, int options,
7f163d
              : 0;
7f163d
   }
7f163d
 
7f163d
+  free (di.comps);
7f163d
+  free (di.subs);
7f163d
   return status;
7f163d
 }
7f163d
 
7f163d
@@ -6588,16 +6564,12 @@ is_ctor_or_dtor (const char *mangled,
7f163d
   cplus_demangle_init_info (mangled, DMGL_GNU_V3, strlen (mangled), &di);
7f163d
 
7f163d
   {
7f163d
-#ifdef CP_DYNAMIC_ARRAYS
7f163d
-    __extension__ struct demangle_component comps[di.num_comps];
7f163d
-    __extension__ struct demangle_component *subs[di.num_subs];
7f163d
-
7f163d
-    di.comps = comps;
7f163d
-    di.subs = subs;
7f163d
-#else
7f163d
-    di.comps = alloca (di.num_comps * sizeof (*di.comps));
7f163d
-    di.subs = alloca (di.num_subs * sizeof (*di.subs));
7f163d
-#endif
7f163d
+    di.comps
7f163d
+      = (struct demangle_component *) xmalloc (di.num_comps
7f163d
+					       * sizeof (*di.comps));
7f163d
+    di.subs
7f163d
+      = (struct demangle_component **) xmalloc (di.num_subs
7f163d
+						* sizeof (*di.subs));
7f163d
 
7f163d
     dc = cplus_demangle_mangled_name (&di, 1);
7f163d
 
7f163d
@@ -6640,6 +6612,8 @@ is_ctor_or_dtor (const char *mangled,
7f163d
       }
7f163d
   }
7f163d
 
7f163d
+  free (di.comps);
7f163d
+  free (di.subs);
7f163d
   return ret;
7f163d
 }
7f163d
 
7f163d
diff --git a/libiberty/make-relative-prefix.c b/libiberty/make-relative-prefix.c
7f163d
index e3f9f920..5dbe6f89 100644
7f163d
--- a/libiberty/make-relative-prefix.c
7f163d
+++ b/libiberty/make-relative-prefix.c
7f163d
@@ -259,10 +259,7 @@ make_relative_prefix_1 (const char *progname, const char *bin_prefix,
7f163d
 #ifdef HAVE_HOST_EXECUTABLE_SUFFIX
7f163d
 	  len += strlen (HOST_EXECUTABLE_SUFFIX);
7f163d
 #endif
7f163d
-	  if (len < MAX_ALLOCA_SIZE)
7f163d
-	    nstore = (char *) alloca (len);
7f163d
-	  else
7f163d
-	    alloc_ptr = nstore = (char *) malloc (len);
7f163d
+	  alloc_ptr = nstore = (char *) malloc (len);
7f163d
 
7f163d
 	  startp = endp = temp;
7f163d
 	  while (1)