From 451623a5a15eb7bd5f722d0502db9a4a6daec017 Mon Sep 17 00:00:00 2001 From: Sameer Agarwal Date: Wed, 11 Jul 2012 11:15:25 -0700 Subject: [PATCH] Fix use of uninitialized arrays. gradient_checking_cost_function_test.cc was using arrays without initializing them which triggers valgrind errors, and causes failures when built on the N900. Thanks to Sebastian Koch for reporting the error and Markus Moll for pin pointing the cause of the error. Change-Id: Iee498969bb5026eb302ea2990edf189e70f97800 --- internal/ceres/gradient_checking_cost_function_test.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/ceres/gradient_checking_cost_function_test.cc b/internal/ceres/gradient_checking_cost_function_test.cc index cde613b94..58a49b96b 100644 --- a/internal/ceres/gradient_checking_cost_function_test.cc +++ b/internal/ceres/gradient_checking_cost_function_test.cc @@ -340,7 +340,11 @@ void ParameterBlocksAreEquivalent(const ParameterBlock* left, } TEST(GradientCheckingProblemImpl, ProblemDimensionsMatch) { - double x[3], y[4], z[5], w[4]; + // Parameter blocks with arbitrarily chosen initial values. + double x[] = {1.0, 2.0, 3.0}; + double y[] = {4.0, 5.0, 6.0, 7.0}; + double z[] = {8.0, 9.0, 10.0, 11.0, 12.0}; + double w[] = {13.0, 14.0, 15.0, 16.0}; ProblemImpl problem_impl; problem_impl.AddParameterBlock(x, 3);