From 1be6449f2e1bd51393a55b06b967f43dc9be6ec6 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Thu, 9 Dec 2010 02:38:07 -0500 Subject: fix bug #127. our product selection logic was flawed in that it used the Max-sized to determine whether the size is 1. + test. --- test/product_extra.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test/product_extra.cpp') diff --git a/test/product_extra.cpp b/test/product_extra.cpp index fcedacb2c..60f00a4da 100644 --- a/test/product_extra.cpp +++ b/test/product_extra.cpp @@ -116,6 +116,30 @@ template void product_extra(const MatrixType& m) VERIFY_IS_APPROX(tmp, m1 * m1.adjoint() * s1); } +void zero_sized_objects() +{ + // Bug 127 + // + // a product of the form lhs*rhs with + // + // lhs: + // rows = 1, cols = 4 + // RowsAtCompileTime = 1, ColsAtCompileTime = -1 + // MaxRowsAtCompileTime = 1, MaxColsAtCompileTime = 5 + // + // rhs: + // rows = 4, cols = 0 + // RowsAtCompileTime = -1, ColsAtCompileTime = -1 + // MaxRowsAtCompileTime = 5, MaxColsAtCompileTime = 1 + // + // was failing on a runtime assertion, because it had been mis-compiled as a dot product because Product.h was using the + // max-sizes to detect size 1 indicating vectors, and that didn't account for 0-sized object with max-size 1. + + Matrix a(1,4); + Matrix b(4,0); + a*b; +} + void test_product_extra() { for(int i = 0; i < g_repeat; i++) { @@ -123,5 +147,6 @@ void test_product_extra() CALL_SUBTEST_2( product_extra(MatrixXd(internal::random(1,320), internal::random(1,320))) ); CALL_SUBTEST_3( product_extra(MatrixXcf(internal::random(1,150), internal::random(1,150))) ); CALL_SUBTEST_4( product_extra(MatrixXcd(internal::random(1,150), internal::random(1,150))) ); + CALL_SUBTEST_5( zero_sized_objects() ); } } -- cgit v1.2.3