rs6000.c (rs6000_encode_section_info): Fix string length calculation and allocation.
authorFranz Sirl <Franz.Sirl-kernel@lauterbach.com>
Sun, 19 Nov 2000 18:49:32 +0000 (18:49 +0000)
committerFranz Sirl <sirl@gcc.gnu.org>
Sun, 19 Nov 2000 18:49:32 +0000 (18:49 +0000)
2000-11-19  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>

* rs6000/rs6000.c (rs6000_encode_section_info): Fix string length
calculation and allocation.

From-SVN: r37567

gcc/ChangeLog
gcc/config/rs6000/rs6000.c

index 7788cd0..18358d4 100644 (file)
@@ -1,3 +1,8 @@
+2000-11-19  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>
+
+       * rs6000/rs6000.c (rs6000_encode_section_info): Fix string length
+       calculation and allocation.
+
 2000-11-19  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * builtins.c (c_getstr): Constify variable.
index 6dbcb25..30a99bb 100644 (file)
@@ -7621,11 +7621,11 @@ rs6000_encode_section_info (decl)
        {
          rtx sym_ref = XEXP (DECL_RTL (decl), 0);
          size_t len = strlen (XSTR (sym_ref, 0));
-         char *str = alloca (len + 1);
+         char *str = alloca (len + 2);
 
          str[0] = '@';
          memcpy (str + 1, XSTR (sym_ref, 0), len + 1);
-         XSTR (sym_ref, 0) = ggc_alloc_string (str, len);
+         XSTR (sym_ref, 0) = ggc_alloc_string (str, len + 1);
        }
     }
 }