Re: [eigen] wrong result when not inlining (at least with vs.net) |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] wrong result when not inlining (at least with vs.net)
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Fri, 15 May 2009 04:33:23 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=zyHdysCTuoyrh5bO90Yv45lnP1zySuadyiGhaRwGSBQ=; b=NYODj/j3A71aMeJwQ8uM6UyIYY5RSpa8sEkMbfzKdRg3QupyjryC17XUknIP1c2e7D yc6b6iNN4DkcDKA7CgOEBlDyquX+Wmpy9s3PIBPQ3LcMIKhoYMqBw5SXYzYTKhyHHhDQ b48rbJdMcmtjXfdq1W0Zkk/We7zG+ddiBul18=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=I/622PsltoORPbrKEEMFa0IaIXdzVSlijRzIL7qEYuvco6m8kLHVzBu6Ycjh5tXfda NJZzthHNRYACtIeG3joHq4vgbIRgpsXAYOXtNMr+AiPNvramgQnY3pKgJFcv0illTDpF F5NHu6/xux2vxg0hCI/LnvRF3vYDRXrJSN5jM=
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...
Hauke:
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.
Cheers,
Benoit
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.
>