diff options
author | Olivier Hainque <hainque@act-europe.fr> | 2003-10-15 19:24:44 +0200 |
---|---|---|
committer | Olivier Hainque <hainque@gcc.gnu.org> | 2003-10-15 17:24:44 +0000 |
commit | 0f229b22bb0f6b0c24e0ef69e3f45368524748e3 (patch) | |
tree | aa25047fd77abafb80dca767d9b4f7418f43c3e3 | |
parent | 8bf06993c1664e62690b0e5f7bf1c2197e1c9199 (diff) | |
download | gcc-0f229b22bb0f6b0c24e0ef69e3f45368524748e3.zip gcc-0f229b22bb0f6b0c24e0ef69e3f45368524748e3.tar.gz gcc-0f229b22bb0f6b0c24e0ef69e3f45368524748e3.tar.bz2 |
genmodes.c (calc_wider_mode): Allocate enough room for all the entries we'll possibly assign in the sort buffer.
* genmodes.c (calc_wider_mode): Allocate enough room for all the
entries we'll possibly assign in the sort buffer.
From-SVN: r72531
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/genmodes.c | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c4e9d35..41b0ead 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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. diff --git a/gcc/genmodes.c b/gcc/genmodes.c index f9d4829..127392c 100644 --- a/gcc/genmodes.c +++ b/gcc/genmodes.c @@ -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++) { |