summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scilab/modules/optimization/sci_gateway/fortran/sci_f_optim.f6
-rw-r--r--tests/nonRegression/bug2435.sci19
2 files changed, 22 insertions, 3 deletions
diff --git a/scilab/modules/optimization/sci_gateway/fortran/sci_f_optim.f b/scilab/modules/optimization/sci_gateway/fortran/sci_f_optim.f
index 3ed84d6..8e0d693 100644
--- a/scilab/modules/optimization/sci_gateway/fortran/sci_f_optim.f
+++ b/scilab/modules/optimization/sci_gateway/fortran/sci_f_optim.f
@@ -129,7 +129,7 @@ c contraintes de borne (chaine "b" , xinf , xsup )
129 endif 129 endif
130 top2=top2+1 130 top2=top2+1
131 il=iadr(lstk(top2)) 131 il=iadr(lstk(top2))
132 if(istk(il).gt.2) then 132 if(istk(il).gt.2.or.istk(il).eq.0) then
133 err=top2-topin 133 err=top2-topin
134 call error(54) 134 call error(54)
135 return 135 return
@@ -144,7 +144,7 @@ c contraintes de borne (chaine "b" , xinf , xsup )
144 endif 144 endif
145 top2=top2+1 145 top2=top2+1
146 il=iadr(lstk(top2)) 146 il=iadr(lstk(top2))
147 if(istk(il).gt.2) then 147 if(istk(il).gt.2.or.istk(il).eq.0) then
148 err=top2-topin 148 err=top2-topin
149 call error(54) 149 call error(54)
150 return 150 return
@@ -167,7 +167,7 @@ c contraintes de borne (chaine "b" , xinf , xsup )
167 end if 167 end if
168c 168c
169c point initial 169c point initial
170 if(istk(il).gt.2) then 170 if(istk(il).gt.2.or.istk(il).eq.0) then
171 err=top2-topin 171 err=top2-topin
172 call error(54) 172 call error(54)
173 return 173 return
diff --git a/tests/nonRegression/bug2435.sci b/tests/nonRegression/bug2435.sci
new file mode 100644
index 0000000..f78eee1
--- /dev/null
+++ b/tests/nonRegression/bug2435.sci
@@ -0,0 +1,19 @@
1// Scilab Project - Serge Steer
2// Copyright INRIA 2007
3// Date : June 2007
4
5mode(-1) ;
6clear ;
7BugNumber=2435;
8
9function [f,g,ind]=cost(x,ind)
10 xref=[1;2;3];
11 f=0.5*norm(x-xref)^2
12 g=x-xref;
13endfunction
14
15x0=[1;-1;1];
16T=execstr('[f,xopt]=optim(cost,,''b'',-2*ones(x0),2*ones(x0),x0);','errcatch')==54
17
18affich_result(T,BugNumber) ;
19clear ;