octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Comparison with NaN


From: Michael Goffioul
Subject: Re: Comparison with NaN
Date: Mon, 11 May 2009 22:23:37 +0100

I could further track down the Array<double> instantiation to the
fact that Array-C.cc ends up including dMatrix.h. This header
defines a Array<double>-inherited class with dllexport, which
makes MSVC to instantiate Array<double>.

The strange thing is the sequence of inclusion that leads to dMatrix.h:
ArrayN.cc
ArrayN-idx.h
Range.h
dMatrix.h

However, inspecting ArrayN-idx.h, everything is commented out,
except 3 include statements. I'm not sure what's the purpose of
that file, but commenting everything solved my problem.

Now I'm left with 5 test failures, one of which I don't know what to
think about (I'm not even sure this is a problem...):

***** test
 [v, i] = sort ([NaN, 1i, -1, Inf, 1, 1i]);
 assert (v, [1, 1i, 1i, -1, Inf, NaN])
 assert (i, [5, 2, 6, 3, 4, 1])
!!!!! test failed
assert (i,[5, 2, 6, 3, 4, 1]) expected
   5   2   6   3   4   1
but got
   5   6   2   3   4   1


Michael.


On Mon, May 11, 2009 at 9:39 PM, Michael Goffioul
<address@hidden> wrote:
> I tracked down the problem in the debugger and could determine that
> the version of sort_isnan<double> linked into octave is not the specialized
> one, but the generic one (which returns false). Inspecting the objects files,
> I could find an instantiation of sort_isnan<double> in Array-C.o, Array-ch.o,
> Array-b.o, Array-d.o, Array-f.o and Array-fC.o. At link stage, I think
> the linker
> is just picking the first one appearing, that is the one from Array-C.o (hence
> not the specialized one). I see in Array-d.cc that sort_isnan<double> should
> be inlined, but I compile with debug enabled and I think MSVC does not do
> any inlining in debug mode.
>
> What I could check is that:
> 1) when re-ordering the objects file such that Array-d.o is picked first, the
> specialized version of sort_isnan is linked in
> 2) when using 'extern template bool sort_isnan<double>(double);' in all
> Array-xx.c (except Array-d.cc), no instantiation of sort_isnan<double>
> occurs in the corresponding object files, and the specialized version
> (the only one remaining) is compiled in
>
> Now, why MSVC does instantiate sort_isnan<double> in other files than
> Array-d.cc? I'm not sure, but when inspecting a pre-processed Array-C.cc,
> I see usage of Array<double> in idx-vector.h; this might trigger instantiation
> of Array<double> class, leading to instantiation of sort_isnan<double>.
> But this is just a wikd guess...
>
> Michael.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]