I've kind of "fixed" the problems in vnl and in tbl. At least, I suppose so.
Modifications have been checked in.
I've (temporarily?) commented out the offending tests in test_numeric_traits and in test_pow_log;
or actually: I've placed them inside a TEST_SIGNED_OVERFLOW conditional.
This could in the future become a kind of configurable test, e.g. to find out which platforms allow or correctly handle signed overflow.
(Should then probably be renamed to something like "VNL_CONFIG_SIGNED_OVERFLOW").
Markus' idea was probably a better solution, I agree. Feel free to modify.
The problems in tbl/vepl were caused by a signed int (return value of function "difference") which was used as a kind of hash value.
I've replaced it with unsigned int (and modified the expected return values accordingly).
The "extreme testing" in core/vsl/tests/test_arbitrary_length_int_conversion.cxx causes one of the overflows; maybe that test should be changed to using unsigned long instead of long?
Some of the other problems seem to come from code outside vxl, viz. TIFFReadDirectory() and v3p_netlib_urand_().
----- Ursprungligt meddelande ----
Från: Markus Moll <Markus.Moll@...>
Skickat: torsdag, 4 augusti 2011 0:19
Ämne: Re: [Vxl-users] vxl dashboard, undefined behaviour, and clang
On Wed, 3 Aug 2011 17:02:07 -0400, Sean McBride wrote:
> I guess there are other problems that make this change insufficient
> to get more tests passing. :( I spent a little time looking at some
> the other failures. Here is a patch that removes some tests that
> undefined results anyway.
Some of those can be fixed, however.
For signed integer type T (with corresponding unsigned type UT) and T
tm = vnl_numeric_traits<T>::maxval, the test could be
T tmplusone = static_cast<T>( static_cast<UT>(tm) + 1 );
TEST("vnl_numeric_traits<T>::maxval must be the largest possible",
tmplusone <= tm, true);
The conversion to UT is well defined and preserves the value, the
increment is well-defined for unsigned type UT, then
a) either UT(tm) + 1 can still be represented as a T, then tmplusone
== tm + 1
b) or UT(tm) + 1 cannot be represented as a T, then the tmplusone is
implementation defined and <= tm.
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts.
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
Vxl-users mailing list