This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Sat, Nov 15, 2014 at 8:01 AM, Janne Blomqvist <blomqvist.janne@gmail.com> wrote: > On Fri, Nov 14, 2014 at 11:02 PM, Tobias Burnus <burnus@net-b.de> wrote: >> I think instead of doing a run-time check I'd prefer something like the >> following, keeping the compile-time assert. >> >> --- a/libgfortran/intrinsics/random.c >> +++ b/libgfortran/intrinsics/random.c >> @@ -253 +253 @@ static GFC_UINTEGER_4 kiss_default_seed[] = { >> -static const GFC_INTEGER_4 kiss_size = >> sizeof(kiss_seed)/sizeof(kiss_seed[0]); >> +#define KISS_SIZE ((GFC_INTEGER_4) (sizeof(kiss_seed)/sizeof(kiss_seed[0])) >> >> (plus s/kiss_size/KISS_SIZE/ changes in the code.) >> >> Janne, what do you think? > > I like it. With this, you can also get rid of the assert and the newly > introduced KISS_MAX_SIZE macro, and just make the seed array the > correct size, as was originally done (with a VLA). Consider such a > patch pre-approved. I went ahead and did it myself, committed the attached patch as r217623 after regtesting. 2014-11-16 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/60324 * intrinsics/random.c (kiss_size): Rename to KISS_SIZE, make it a macro instead of a variable. (random_seed_i4): Make seed correct size, remove assert, KISS_SIZE related changes. (random_seed_i8): KISS_SIZE related changes. -- Janne Blomqvist
Attachment:
vla-random.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |