On 05/02/2016 11:28 AM, address@hidden wrote:
Subject:
Bad-sounding schur.cc compilation warnings.
From:
Daniel J Sebald <address@hidden>
Date:
05/02/2016 10:59 AM
To:
Maintainers List Octave <address@hidden>
List-Post:
<mailto:address@hidden>
Content-Transfer-Encoding:
7bit
Precedence:
list
MIME-Version:
1.0
Message-ID:
<address@hidden>
Content-Type:
text/plain; charset=utf-8; format=flowed
Message:
3
I saw the following warnings during compilation. They look kind of
troublesome:
/home/sebald/octave/octave/octave/liboctave/numeric/schur.cc: In
member function 'octave_idx_type schur<T>::init(const T&, const
string&, bool) [with T = Matrix; octave_idx_type = int; std::string =
std::basic_string<char>]':
/home/sebald/octave/octave/octave/liboctave/numeric/schur.cc:176:19:
warning: variable 'selector' might be clobbered by 'longjmp' or
'vfork' [-Wclobbered]
double_selector selector = 0;
^
/home/sebald/octave/octave/octave/liboctave/numeric/schur.cc: In
member function 'octave_idx_type schur<T>::init(const T&, const
string&, bool) [with T = FloatMatrix; octave_idx_type = int;
std::string = std::basic_string<char>]':
/home/sebald/octave/octave/octave/liboctave/numeric/schur.cc:265:18:
warning: variable 'selector' might be clobbered by 'longjmp' or
'vfork' [-Wclobbered]
float_selector selector = 0;
^
/home/sebald/octave/octave/octave/liboctave/numeric/schur.cc: In
member function 'octave_idx_type schur<T>::init(const T&, const
string&, bool) [with T = ComplexMatrix; octave_idx_type = int;
std::string = std::basic_string<char>]':
/home/sebald/octave/octave/octave/liboctave/numeric/schur.cc:354:20:
warning: variable 'selector' might be clobbered by 'longjmp' or
'vfork' [-Wclobbered]
complex_selector selector = 0;
^
/home/sebald/octave/octave/octave/liboctave/numeric/schur.cc: In
member function 'octave_idx_type schur<T>::init(const T&, const
string&, bool) [with T = FloatComplexMatrix; octave_idx_type = int;
std::string = std::basic_string<char>]':
/home/sebald/octave/octave/octave/liboctave/numeric/schur.cc:463:26:
warning: variable 'selector' might be clobbered by 'longjmp' or
'vfork' [-Wclobbered]
float_complex_selector selector = 0;
Dan
The warnings are ugly, but they aren't hazardous to Octave. The wrapper
around Fortran function calls can potentially use longjmp to recover
from errors which is why you're getting the message. If you look at the
actual C++ code it immediately returns after calling the Fortran
function and so any clobbered value would not get used.
Most of the time we have used the volatile keyword as part of the
variable declaration just to quiet the compiler. There is probably a
small performance penalty for doing so, but since we've done it
everywhere else, we could also do it here. For what it's worth, I don't
get any such nasty warning with gcc-5.2.1.