From: Olivier Hainque Date: Wed, 15 Oct 2003 17:24:44 +0000 (+0200) Subject: genmodes.c (calc_wider_mode): Allocate enough room for all the entries we'll possibly... X-Git-Tag: releases/gcc-3.4.0~2994 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0f229b22bb0f6b0c24e0ef69e3f45368524748e3;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c4e9d3571518..41b0ead0728b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2003-10-15 Olivier Hainque + + * 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 * config.gcc (s390x-ibm-tpf*): New target. diff --git a/gcc/genmodes.c b/gcc/genmodes.c index f9d482900153..127392cf5a5c 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++) {