[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 3.2.0
From: |
John W. Eaton |
Subject: |
Re: 3.2.0 |
Date: |
Wed, 20 May 2009 14:23:11 -0400 |
On 19-May-2009, Michael Goffioul wrote:
| 2) use a volatile octave_idx_type as argument for const octave_idx_type&
|
| What's the reason of declaring "i" volatile in this case?
|
| Michael.
|
| ../../liboctave/CmplxQR.cc(330) : error C2780: 'const _Ty
| &std::min(const _Ty &,const _Ty &,_Pr)' : expects 3 arguments - 2
| provided
| C:\Program Files\Microsoft Visual Studio
| 9.0\VC\INCLUDE\xutility(3379) : see declaration of 'std::min'
| ../../liboctave/CmplxQR.cc(330) : error C2782: 'const _Ty
| &std::min(const _Ty &,const _Ty &)' : template parameter '_Ty' is
| ambiguous
| C:\Program Files\Microsoft Visual Studio
| 9.0\VC\INCLUDE\xutility(3371) : see declaration of 'std::min'
| could be 'volatile octave_idx_type'
| or 'octave_idx_type'
| ../../liboctave/CmplxQR.cc(330) : error C2664: 'zqrinc_' : cannot
| convert parameter 2 from 'volatile octave_idx_type' to 'const
| octave_idx_type &'
| Conversion loses qualifiers
| ../../liboctave/CmplxQR.cc(387) : error C2664: 'zqrdec_' : cannot
| convert parameter 2 from 'volatile octave_idx_type' to 'const
| octave_idx_type &'
| Conversion loses qualifiers
It's declared volatile to avoid the following warning from GCC:
g++ -c -fPIC -I. -I/home/jwe/src/octave/liboctave -I.. -I../liboctave
-I../src -I../libcruft/misc -I/home/jwe/src/octave
-I/home/jwe/src/octave/liboctave -I/home/jwe/src/octave/src
-I/home/jwe/src/octave/libcruft/misc -DHAVE_CONFIG_H -I/usr/include/freetype2
-Wall -W -Wshadow -Wold-style-cast -Wformat -g -O2
/home/jwe/src/octave/liboctave/CmplxQR.cc -o pic/CmplxQR.o
/home/jwe/src/octave/liboctave/CmplxQR.cc: In member function 'void
ComplexQR::insert_col(const ComplexMatrix&, const Array<int>&)':
/home/jwe/src/octave/liboctave/CmplxQR.cc:324: warning: variable 'i' might be
clobbered by 'longjmp' or 'vfork'
As I understand it, the problem is that the F77_XFCN macro uses
setjmp inside a for loop which uses I again after the call to setjmp.
So if I is placed in a register, it might be invalid if the function
called by F77_XFCN ends up doing a longjmp. Declaring I as volatile
prevents GCC from placing it in a register, so the value is still
valid after a longjmp.
Does the following change avoid the problem you are seeing? If so, I
don't have a problem with making changes like this as needed.
jwe
diff --git a/liboctave/CmplxQR.cc b/liboctave/CmplxQR.cc
--- a/liboctave/CmplxQR.cc
+++ b/liboctave/CmplxQR.cc
@@ -323,10 +323,11 @@
OCTAVE_LOCAL_BUFFER (double, rw, kmax);
for (volatile octave_idx_type i = 0; i < js.length (); i++)
{
+ octave_idx_type ii = i;
ComplexColumnVector utmp = u.column (jsi(i));
- F77_XFCN (zqrinc, ZQRINC, (m, n + i, std::min (kmax, k + i),
+ F77_XFCN (zqrinc, ZQRINC, (m, n + ii, std::min (kmax, k + ii),
q.fortran_vec (), q.rows (),
- r.fortran_vec (), r.rows (), js(i) + 1,
+ r.fortran_vec (), r.rows (), js(ii) + 1,
utmp.data (), rw));
}
}
Re: 3.2.0, Michael Goffioul, 2009/05/19
- Re: 3.2.0, Jaroslav Hajek, 2009/05/19
- Re: 3.2.0, Michael Goffioul, 2009/05/19
- Re: 3.2.0,
John W. Eaton <=
- Re: 3.2.0, Michael Goffioul, 2009/05/20
Re: 3.2.0, Michael Goffioul, 2009/05/20
Re: 3.2.0, Jaroslav Hajek, 2009/05/20
Re: 3.2.0, Michael Goffioul, 2009/05/20
Re: 3.2.0, Jaroslav Hajek, 2009/05/20
Re: 3.2.0, Michael Goffioul, 2009/05/20
Re: 3.2.0, Jaroslav Hajek, 2009/05/21
Re: 3.2.0, Michael Goffioul, 2009/05/21
Re: 3.2.0, Jaroslav Hajek, 2009/05/21
Re: 3.2.0, Michael Goffioul, 2009/05/21