aboutsummaryrefslogtreecommitdiff
path: root/gcc/genmodes.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/genmodes.c')
-rw-r--r--gcc/genmodes.c4
1 files changed, 3 insertions, 1 deletions
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++)
{