[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
clobbered
From: |
Andy Jacobson |
Subject: |
clobbered |
Date: |
Thu, 02 Nov 2000 13:32:31 +0100 |
Howdy,
When creating oct files, sometimes the compiler spews out a
bunch of warnings like:
corto:þ/ibex/nlo> mkoctfile -v amebsa.cc
c++ -c -fPIC -I/usr/local/include -I/usr/local/include/octave-2.0.16 -mieee-fp
-fno-rtti -fno-exceptions -fno-implicit-templates -g -O2 -Wall amebsa.cc -o
amebsa.o
amebsa.cc: In function `class octave_value_list Famebsa(const class
octave_value_list &, int)':
amebsa.cc:48: warning: variable `int iter' might be clobbered by `longjmp' or
`vfork'
amebsa.cc:51: warning: variable `int targiter' might be clobbered by `longjmp'
or `vfork'
amebsa.cc:53: warning: variable `int i' might be clobbered by `longjmp' or
`vfork'
amebsa.cc:53: warning: variable `int ihi' might be clobbered by `longjmp' or
`vfork'
amebsa.cc:53: warning: variable `int ilo' might be clobbered by `longjmp' or
`vfork'
amebsa.cc:54: warning: variable `double ylo' might be clobbered by `longjmp' or
`vfork'
amebsa.cc:54: warning: variable `double ynhi' might be clobbered by `longjmp'
or `vfork'
amebsa.cc:87: warning: variable `int n' might be clobbered by `longjmp' or
`vfork'
/usr/local/include/octave/Array.h:194: warning: variable `int n' might be
clobbered by `longjmp' or `vfork'
...for another 30 lines or so.
I use the same template .cc file for different codes, but only
some of them give this set of warnings. They do this quite
robustly. Can anyone explain why this is happening, and need I
be concerned that my variables ARE being clobbered?
The .cc file, containing two functions, follows. Since it is an
adaptation of copyrighted material, I have removed the core of
the routines, leaving the entrance/exit stuff and variable
declarations.
Thanks,
Andy
// adapted by Andy Jacobson for .oct
// original implementation from Numerical Recipes in C by Press et al.
#include <octave/pager.h>
#include <iostream.h>
#include <octave/oct.h>
#include <octave/pt-fvc.h>
#include <math.h>
#include <octave/f77-fcn.h>
// The chi-squared function we are minimizing is positive semi-definite. Signal
// a violation of constraint with a negative return value.
#define CONSTRAINT_NOT_VIOLATED(y) (y >= 0)
#define CONSTRAINT_WAS_VIOLATED(y) (y < 0)
double amebsa_try(Matrix &p, ColumnVector &y, ColumnVector &psum, int ndim,
ColumnVector &pb,
double *yb, int ihi, double *yhi, double fac);
extern "C"
{
int F77_FCN (dgenunf, DGENUNF) (const double&, const double&,
double&);
}
double tt;
static tree_fvc *funk;
octave_value_list *fin,fout;
DEFUN_DLD(amebsa, args, nargout,
"[p,y,iter,pb,yb]=amebsa(p,y,ndim,yb,ftol,funk,iter,temptr)") {
// convert arguments to expected values
Matrix p=args(0).matrix_value();
ColumnVector y=args(1).vector_value();
int ndim=(int)args(2).double_value();
double yb=args(3).double_value();
double ftol=args(4).double_value();
funk = is_valid_function (args(5), "amebsa", 1);
int iter=(int)args(6).double_value();
double temptr=args(7).double_value();
int targiter=iter,diter=(int)floor(iter/10);
double ranval=0;
int i,ihi,ilo,j,m,n,mpts;
double rtol,sum,swap,yhi,ylo,ynhi,ysave,yt,ytry;
mpts=ndim+1;
octave_value_list retval;
if (! funk) {
error ("No valid function found.");
return retval;
}
fprintf(stdout,"T: %8g [",temptr);
flush_octave_stdout();
ColumnVector psum(ndim),pb(ndim);
<STUFF DELETED>
octave_stdout << "] rtol = " << rtol << 'Ün' ;
flush_octave_stdout();
retval(0)=p;
retval(1)=y;
retval(2)=(double)iter;
retval(3)=pb;
retval(4)=yb;
return (retval);
}
#undef AMEBSA_GET_PSUM
double amebsa_try(Matrix &p, ColumnVector &y, ColumnVector &psum, int ndim,
ColumnVector &pb,
double *yb, int ihi, double *yhi, double fac) {
double ranval=0;
int j;
double fac1,fac2,yflu,ytry;
ColumnVector ptry(ndim);
fin = new octave_value_list;
<STUFF DELETED>
return yflu;
}
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- clobbered,
Andy Jacobson <=