* Bug #13513 fixed - EXPRESSION block with "u1" as expression failed with a 52/14752/5
Clément DAVID [Thu, 26 Jun 2014 15:39:59 +0000 (17:39 +0200)]
                     singularity error.

Thanks to Michael Ungelehrt from the user mailing-list to spot that.
This is a regression introduced at f3caed27 .

Change-Id: Icfe32c8b31712174affc3fcacf37db7b4e2fc8d4

scilab/CHANGES_5.5.X
scilab/modules/scicos_blocks/src/c/evaluate_expr.c
scilab/modules/xcos/tests/nonreg_tests/bug_13513.dia.ref [new file with mode: 0644]
scilab/modules/xcos/tests/nonreg_tests/bug_13513.tst [new file with mode: 0644]
scilab/modules/xcos/tests/nonreg_tests/bug_13513.zcos [new file with mode: 0644]

index 58014fa..4aa8f15 100644 (file)
@@ -193,6 +193,9 @@ Xcos Bug Fixes
 
 * Bug #13396 fixed - MBLOCK did not work with an external file containing the modelica class.
 
+* Bug #13513 fixed - EXPRESSION block with "u1" as expression failed with a 
+                     singularity error.
+
 
 Known issues
 =============
index f869a2d..5ad8049 100644 (file)
@@ -111,7 +111,7 @@ SCICOS_BLOCKS_IMPEXP void evaluate_expr(scicos_block *block, int flag)
                 case 5:
                     count = count + 1;
                     /* invalid script : call a function without lhs */
-                    if (bottom <= 0)
+                    if (bottom < 0)
                     {
                         set_block_error(-2);
                         return;
@@ -491,11 +491,11 @@ SCICOS_BLOCKS_IMPEXP void evaluate_expr(scicos_block *block, int flag)
                                 stack[bottom] = (double) block->mode[nzcr];
                             }
                             break;
-                            /*  if (stack[bottom]>0) {
-                              stack[bottom]=floor(stack[bottom]+.5);
-                            }else{
-                              stack[bottom]=ceil(stack[bottom]-.5);
-                            }*/
+                        /*  if (stack[bottom]>0) {
+                          stack[bottom]=floor(stack[bottom]+.5);
+                        }else{
+                          stack[bottom]=ceil(stack[bottom]-.5);
+                        }*/
                         case 111:
                             if (block->ng > 0)
                             {
@@ -595,13 +595,13 @@ SCICOS_BLOCKS_IMPEXP void evaluate_expr(scicos_block *block, int flag)
                                 stack[bottom] = (double) block->mode[nzcr];
                             }
                             break;
-                            /* if (stack[bottom]>0) {
-                              stack[bottom]=1.0;
-                            }else if(stack[bottom]<0){
-                              stack[bottom]=-1.0;
-                            }else{
-                              stack[bottom]=0.0;
-                              }*/
+                        /* if (stack[bottom]>0) {
+                          stack[bottom]=1.0;
+                        }else if(stack[bottom]<0){
+                          stack[bottom]=-1.0;
+                        }else{
+                          stack[bottom]=0.0;
+                          }*/
                         case 114:  /* abs */
                             if (block->ng > 0)
                             {
@@ -643,11 +643,11 @@ SCICOS_BLOCKS_IMPEXP void evaluate_expr(scicos_block *block, int flag)
                                 stack[bottom] = stack[bottom] * (block->mode[nzcr]);
                             }
                             break;
-                            /* if (stack[bottom]>0) {
-                              stack[bottom]=stack[bottom];
-                            }else {
-                              stack[bottom]=-stack[bottom];
-                              }*/
+                        /* if (stack[bottom]>0) {
+                          stack[bottom]=stack[bottom];
+                        }else {
+                          stack[bottom]=-stack[bottom];
+                          }*/
                         case 115:
                             if (block->ng > 0)
                             {
diff --git a/scilab/modules/xcos/tests/nonreg_tests/bug_13513.dia.ref b/scilab/modules/xcos/tests/nonreg_tests/bug_13513.dia.ref
new file mode 100644 (file)
index 0000000..b7d3cc2
--- /dev/null
@@ -0,0 +1,18 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Clément DAVID
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+// <-- XCOS TEST -->
+//
+// <-- Non-regression test for bug XXXXX -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=XXXXX
+//
+// <-- Short Description -->
+// EXPRESSION block with parameter "u1" report a singularity error.
+assert_checktrue(importXcosDiagram(SCI + "/modules/xcos/tests/nonreg_tests/bug_XXXXX.zcos"));
+// compile and simulate
+xcos_simulate(scs_m, 4);
diff --git a/scilab/modules/xcos/tests/nonreg_tests/bug_13513.tst b/scilab/modules/xcos/tests/nonreg_tests/bug_13513.tst
new file mode 100644 (file)
index 0000000..1f93a9c
--- /dev/null
@@ -0,0 +1,22 @@
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2014 - Scilab Enterprises - Clément DAVID
+//
+//  This file is distributed under the same license as the Scilab package.
+// =============================================================================
+
+// <-- XCOS TEST -->
+//
+// <-- Non-regression test for bug 13513 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=13513
+//
+// <-- Short Description -->
+// EXPRESSION block with parameter "u1" report a singularity error.
+
+assert_checktrue(importXcosDiagram(SCI + "/modules/xcos/tests/nonreg_tests/bug_13513.zcos"));
+
+// compile and simulate
+xcos_simulate(scs_m, 4);
+
diff --git a/scilab/modules/xcos/tests/nonreg_tests/bug_13513.zcos b/scilab/modules/xcos/tests/nonreg_tests/bug_13513.zcos
new file mode 100644 (file)
index 0000000..2853f67
Binary files /dev/null and b/scilab/modules/xcos/tests/nonreg_tests/bug_13513.zcos differ