* Bug #9109 fixed - nfreq tagged as obsolete.
+* Bug #9158 fixed - zeros() called with a big number returns an empty matrix.
+
* Bug #9208 fixed - Added three optional output arguments to optim(),
to retrieve #iterations, #evaluations and a termination indicator.
call error(89)
return
endif
+ if (stk(sadr(il+4)).ge.2.0**31) then !depends on the stack (32 bits...)
+ call error(17)
+ return
+ endif
n=max(int(stk(sadr(il+4))),0)
elseif(istk(il).eq.8) then
if(istk(il+1)*istk(il+2).ne.1) then
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Scilab Enterprises - Charlotte HECQUET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 9158 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=9158
+//
+// <-- Short Description -->
+// zeros() called with a number greater than 2**31 returns an empty matrix
+assert_checktrue(execstr("zeros(2**32, 1)", "errcatch") == 17);
+assert_checktrue(execstr("zeros(1, 2**32)", "errcatch") == 17);
+// the same with eye, rand, and ones
+assert_checktrue(execstr("eye(2**32, 1)", "errcatch") == 17);
+assert_checktrue(execstr("eye(1, 2**32)", "errcatch") == 17);
+assert_checktrue(execstr("ones(2**32, 1)", "errcatch") == 17);
+assert_checktrue(execstr("ones(2**32, 1)", "errcatch") == 17);
+assert_checktrue(execstr("rand(2**32, 1)", "errcatch") == 17);
+assert_checktrue(execstr("rand(2**32, 1)", "errcatch") == 17);
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2013 - Scilab Enterprises - Charlotte HECQUET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+//
+// <-- Non-regression test for bug 9158 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=9158
+//
+// <-- Short Description -->
+// zeros() called with a number greater than 2**31 returns an empty matrix
+
+assert_checktrue(execstr("zeros(2**32, 1)", "errcatch") == 17);
+assert_checktrue(execstr("zeros(1, 2**32)", "errcatch") == 17);
+
+// the same with eye, rand, and ones
+assert_checktrue(execstr("eye(2**32, 1)", "errcatch") == 17);
+assert_checktrue(execstr("eye(1, 2**32)", "errcatch") == 17);
+
+assert_checktrue(execstr("ones(2**32, 1)", "errcatch") == 17);
+assert_checktrue(execstr("ones(2**32, 1)", "errcatch") == 17);
+
+assert_checktrue(execstr("rand(2**32, 1)", "errcatch") == 17);
+assert_checktrue(execstr("rand(2**32, 1)", "errcatch") == 17);