From: Stéphane MOTTELET Date: Wed, 2 Oct 2019 10:18:44 +0000 (+0200) Subject: * Bug 16209 fixed: grand(n,m,exp,1) may freeze Scilab with default generator X-Git-Tag: 6.1.0~410 X-Git-Url: http://gitweb.scilab.org/?p=scilab.git;a=commitdiff_plain;h=cea4414fb4690231f225773f29c88776c6dfa23a * Bug 16209 fixed: grand(n,m,exp,1) may freeze Scilab with default generator http://bugzilla.scilab.org/show_bug.cgi?id=16209 Change-Id: I11bb954a7a70d0d2862dba8dddc42d9dcada2fd0 --- diff --git a/scilab/CHANGES.md b/scilab/CHANGES.md index d0a2679..8df34ab 100644 --- a/scilab/CHANGES.md +++ b/scilab/CHANGES.md @@ -186,5 +186,5 @@ Bug Fixes * [#16144](http://bugzilla.scilab.org/show_bug.cgi?id=16144): Addition of sparse matrices gave incorrect results. * [#16174](http://bugzilla.scilab.org/show_bug.cgi?id=16174): `libraryinfo` yielded 0x0 matrix of strings for libs without macro * [#16208](http://bugzilla.scilab.org/show_bug.cgi?id=16208): Using 3D string matrix with old C-api gateways may crash Scilab. - +* [#16209](http://bugzilla.scilab.org/show_bug.cgi?id=16209): grand() causes a freeze after several consecutive calls when using default base generator. diff --git a/scilab/modules/randlib/src/c/sexpo.c b/scilab/modules/randlib/src/c/sexpo.c index b96c03a..a385839 100644 --- a/scilab/modules/randlib/src/c/sexpo.c +++ b/scilab/modules/randlib/src/c/sexpo.c @@ -58,6 +58,7 @@ modifications done by JJV a = 0.0; u = C2F(ranf)(); + u = (u == 0.0) ? C2F(ranf)() : u; goto S30; S20: a += q[0]; diff --git a/scilab/modules/randlib/tests/nonreg_tests/bug_16209.tst b/scilab/modules/randlib/tests/nonreg_tests/bug_16209.tst new file mode 100644 index 0000000..38572a1 --- /dev/null +++ b/scilab/modules/randlib/tests/nonreg_tests/bug_16209.tst @@ -0,0 +1,22 @@ +// =================================================================== +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2019 - Stéphane MOTTELET +// +// This file is distributed under the same license as the Scilab package. +// =================================================================== +// +// <-- CLI SHELL MODE --> +// <-- NO CHECK REF --> +// +// <-- Non-regression test for bug 15840 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/16209 +// +// <-- Short Description --> +// grand() causes a freeze after several consecutive calls when using default base generator. + +for i=1:1858 + grand(1,1e6,"exp",1) +end +grand(1,606052,"exp",1) \ No newline at end of file