diff options
author | hainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-15 17:24:44 +0000 |
---|---|---|
committer | hainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-15 17:24:44 +0000 |
commit | f0873ccc00cf73b81a5267f3eb78eb4cb3a9ab39 (patch) | |
tree | aa25047fd77abafb80dca767d9b4f7418f43c3e3 /gcc/genmodes.c | |
parent | 8dfc10f1868767ccb079767769a6bc8d5996f8cb (diff) | |
download | linaro-gcc-f0873ccc00cf73b81a5267f3eb78eb4cb3a9ab39.tar.gz linaro-gcc-f0873ccc00cf73b81a5267f3eb78eb4cb3a9ab39.tar.bz2 linaro-gcc-f0873ccc00cf73b81a5267f3eb78eb4cb3a9ab39.zip |
* genmodes.c (calc_wider_mode): Allocate enough room for all the
entries we'll possibly assign in the sort buffer.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72531 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/genmodes.c')
-rw-r--r-- | gcc/genmodes.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/genmodes.c b/gcc/genmodes.c index f9d48290015..127392cf5a5 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++) { |