]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
genmodes.c (calc_wider_mode): Allocate enough room for all the entries we'll possibly...
authorOlivier Hainque <hainque@act-europe.fr>
Wed, 15 Oct 2003 17:24:44 +0000 (19:24 +0200)
committerOlivier Hainque <hainque@gcc.gnu.org>
Wed, 15 Oct 2003 17:24:44 +0000 (17:24 +0000)
* genmodes.c (calc_wider_mode): Allocate enough room for all the
entries we'll possibly assign in the sort buffer.

From-SVN: r72531

gcc/ChangeLog
gcc/genmodes.c

index c4e9d357151815e215ea4d42273ab3739c9c8dbb..41b0ead0728b5f1602b906296c6e0204ad6ce481 100644 (file)
@@ -1,3 +1,8 @@
+2003-10-15  Olivier Hainque  <hainque@act-europe.fr>
+
+       * genmodes.c (calc_wider_mode): Allocate enough room for all the
+       entries we'll possibly assign in the sort buffer.
+       
 2003-10-15  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * config.gcc (s390x-ibm-tpf*): New target.
index f9d4829001534adea63d26029c15a436026cb93d..127392cf5a5c7986160f83588d3f629eb46588e6 100644 (file)
@@ -587,7 +587,9 @@ calc_wider_mode (void)
   for (c = 0; c < MAX_MODE_CLASS; c++)
     max_n_modes = MAX (max_n_modes, n_modes[c]);
 
-  sortbuf = alloca (max_n_modes * sizeof (struct mode_data *));
+  /* Allocate max_n_modes + 1 entries to leave room for the extra null
+     pointer assigned after the qsort call below.  */
+  sortbuf = alloca ((max_n_modes + 1) * sizeof (struct mode_data *));
 
   for (c = 0; c < MAX_MODE_CLASS; c++)
     {