From: Cedric Delamarre Date: Thu, 12 Oct 2017 15:00:28 +0000 (+0200) Subject: [bug_15301] ImplicitList fixed when contain a function call which return nothing X-Git-Tag: 6.0.1~156 X-Git-Url: http://gitweb.scilab.org/?p=scilab.git;a=commitdiff_plain;h=e3d1e5badd420362d3c8e2ba636f1e304cc65aa7 [bug_15301] ImplicitList fixed when contain a function call which return nothing test_run ast bug_15301 test_run ast bug_15301 mode_nwni_profiling Change-Id: Iaccb56e0c77b483a85c13c7d1d201e81a5ae9fad --- diff --git a/scilab/CHANGES.md b/scilab/CHANGES.md index d4a3fa3..fd4e14d 100644 --- a/scilab/CHANGES.md +++ b/scilab/CHANGES.md @@ -475,6 +475,7 @@ the [development mailing list](dev@lists.scilab.org) for a particular toolbox. * [#15282](http://bugzilla.scilab.org/show_bug.cgi?id=15282): `help_from_sci` could set an xml:id starting with the forbidden `%` character. * [#15285](http://bugzilla.scilab.org/show_bug.cgi?id=15285): `resize_matrix` did not manage conversion into `int64` and `uint64`. * [#15300](http://bugzilla.scilab.org/show_bug.cgi?id=15300): Distributive assignments like `a=(1,2)` crashed Scilab. +* [#15301](http://bugzilla.scilab.org/show_bug.cgi?id=15301): Sequence constructor `:` failed when a bound was an outputless funtion call. * [#15308](http://bugzilla.scilab.org/show_bug.cgi?id=15308): Unlike `evstr(["1 2";"3 4"])`, `evstr(["1;2" "3;4"])` was not accepted. ### Bugs fixed in 6.0.0: diff --git a/scilab/modules/ast/src/cpp/ast/runvisitor.cpp b/scilab/modules/ast/src/cpp/ast/runvisitor.cpp index dd8a027..f667fa0 100644 --- a/scilab/modules/ast/src/cpp/ast/runvisitor.cpp +++ b/scilab/modules/ast/src/cpp/ast/runvisitor.cpp @@ -1464,11 +1464,17 @@ void RunVisitorT::visitprivate(const ListExp &e) CoverageInstance::stopChrono((void*)&e); throw; } + types::GenericType* pITStart = static_cast(getResult()); - if ((pITStart->getSize() != 1 || (pITStart->isDouble() && pITStart->getAs()->isComplex())) && - pITStart->isList() == false) // list case => call overload + if (pITStart == NULL || + ((pITStart->getSize() != 1 || (pITStart->isDouble() && pITStart->getAs()->isComplex())) && + pITStart->isList() == false)) // list case => call overload { - pITStart->killMe(); + if (pITStart) + { + pITStart->killMe(); + } + setResult(NULL); wchar_t szError[bsiz]; os_swprintf(szError, bsiz, _W("%ls: Wrong type for argument %d: Real scalar expected.\n").c_str(), L"':'", 1); @@ -1488,11 +1494,16 @@ void RunVisitorT::visitprivate(const ListExp &e) } types::GenericType* pITStep = static_cast(getResult()); setResult(NULL); - if ((pITStep->getSize() != 1 || (pITStep->isDouble() && pITStep->getAs()->isComplex())) && - pITStep->isList() == false) // list case => call overload + if (pITStep == NULL || + ((pITStep->getSize() != 1 || (pITStep->isDouble() && pITStep->getAs()->isComplex())) && + pITStep->isList() == false)) // list case => call overload { pITStart->killMe(); - pITStep->killMe(); + if (pITStep) + { + pITStep->killMe(); + } + setResult(NULL); wchar_t szError[bsiz]; os_swprintf(szError, bsiz, _W("%ls: Wrong type for argument %d: Real scalar expected.\n").c_str(), L"':'", 2); @@ -1513,12 +1524,17 @@ void RunVisitorT::visitprivate(const ListExp &e) types::GenericType* pITEnd = static_cast(getResult()); setResult(NULL); - if ((pITEnd->getSize() != 1 || (pITEnd->isDouble() && pITEnd->getAs()->isComplex())) && - pITEnd->isList() == false) // list case => call overload + if (pITEnd == NULL || + ((pITEnd->getSize() != 1 || (pITEnd->isDouble() && pITEnd->getAs()->isComplex())) && + pITEnd->isList() == false)) // list case => call overload { pITStart->killMe(); pITStep->killMe(); - pITEnd->killMe(); + if (pITEnd) + { + pITEnd->killMe(); + } + setResult(NULL); wchar_t szError[bsiz]; os_swprintf(szError, bsiz, _W("%ls: Wrong type for argument %d: Real scalar expected.\n").c_str(), L"':'", 3); diff --git a/scilab/modules/ast/tests/nonreg_tests/bug_15301.tst b/scilab/modules/ast/tests/nonreg_tests/bug_15301.tst new file mode 100644 index 0000000..64bd553 --- /dev/null +++ b/scilab/modules/ast/tests/nonreg_tests/bug_15301.tst @@ -0,0 +1,19 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2017 - ESI - Delamarre Cedric +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// <-- CLI SHELL MODE --> +// <-- NO CHECK REF --> +// +// <-- Non-regression test for bug 15301 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/15301 +// +// <-- Short Description --> +// Sequence constructor ':' failed when a bound was an outputless funtion call + +errmsg = sprintf(_("%ls: Wrong type for argument %d: Real scalar expected.\n"), "'':''",3); +assert_checkerror("1:disp(""ok"")", errmsg);