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