Re: [eigen] wrong result when not inlining (at least with

[ Thread Index | Date Index | More Archives ]

I can reproduce it here with gcc-4.4 / linux.

Gael: seems to have something to do with the ReturnByValue class. It's
got to be a temporary that dies too soon somewhere...

1) did msvc accept your program? you pass argv as "char*" instead of
"char**". Just FYI, you can omit the arguments to main() if you don't
use them.
2) instead of rowwise().sum().sum() you can do directly sum(), that's
not only for vectors.


2009/5/15 Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>:
> Hi,
> after debugging for a long long time I found out that the attached
> trivial test program does not print out a zero when the operator
> 106: operator* (const Transform<Scalar,Dim,Mode>& tr, const Homogeneous& rhs)
> from the Homogenous header is not inlined. As the topic indicates this
> test is currently only true for VC++ 2008 (9.0.30729.1 SP).
> The result turns out to be correct as soon as
> Configuration Properties -> C/C++ -> Optimization -> Inline Function
> Expansion -> /Ob1 or /Ob2
> as a consequence one has to set
> Configuration Properties -> C/C++ -> General -> Debug Information
> Format -> /Zi (not /ZI)
> I have no clue what is the reason for this behaviour and I also tried
> to isolate the problem by extracting ei_homogeneous_left_product_impl
> into a test program but as soon as the operator* call is gone, it is
> working. What happens when the function is not inlined is that
> ei_homogeneous_right_product_impl::m_lhs becomes invalid when the
> function reaches the body of
> 244: template<typename Dest> void evalTo(Dest& dst) const
> even though in the ctor ei_homogeneous_right_product_impl::m_lhs is
> still valid and can even be printed.
> I have no clue what happens on other systems or where exactly this
> subtle error is coming from. If other VC++ users could confirm the
> issue or in case somebody could point me to the actual problem it
> would be more than welcome.
> Regards,
> Hauke
> p.s. I did not check the MSDN knowledge base whether this is a known
> compiler issue or such.

Mail converted by MHonArc 2.6.19+