From: Johnathan Corgan Date: Tue, 6 Jul 2010 04:41:41 +0000 (-0700) Subject: gnuradio-core: trial "fix" for QA failure with debian gcc 4.4.4 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=27ada0c49b62a8b1151089cae976228b41575c3c;p=debian%2Fgnuradio gnuradio-core: trial "fix" for QA failure with debian gcc 4.4.4 Add zeroed 'bumper' space before and after stack allocated input buffer in QA code. Eric Blossom: "Bottom line, the only thing I can think of that might be going on is that we're fetching a NaN off of the end of the input buffer, multiplying it by zero (which works for everything except a NaN), then propagating that through the rest of the calculation. (In particular alignment cases the code does deliberately fetch either before or after the end of the buffer, and it always multiplies those values by zero. If they happen to be NaN's we hosed :-)) In the production code we never see the problem since the circular buffer is zero initialized." Note: qa_gri_mmse_fir_interpolator::t1 now fails with the bumper code in place. --- diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.cc b/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.cc index bb56d178..25083bb2 100644 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.cc +++ b/gnuradio-core/src/lib/filter/qa_gr_fir_fcc.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002 Free Software Foundation, Inc. + * Copyright 2002,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -108,7 +108,10 @@ test_random_io (fir_maker_t maker) const int OUTPUT_LEN = 17; const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - i_type input[INPUT_LEN]; + i_type input_raw[INPUT_LEN + 4*16/sizeof(i_type)]; + memset(input_raw, 0, sizeof(input_raw)); + i_type *input = &input_raw[2*16/sizeof(i_type)]; + o_type expected_output[OUTPUT_LEN]; o_type actual_output[OUTPUT_LEN]; tap_type taps[MAX_TAPS]; diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_fff.cc b/gnuradio-core/src/lib/filter/qa_gr_fir_fff.cc index b921223e..60ba7609 100644 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_fff.cc +++ b/gnuradio-core/src/lib/filter/qa_gr_fir_fff.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002 Free Software Foundation, Inc. + * Copyright 2002,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -147,7 +147,10 @@ test_random_io (fir_maker_t maker) const int OUTPUT_LEN = 17; const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - i_type input[INPUT_LEN]; + i_type input_raw[INPUT_LEN + 4*16/sizeof(i_type)]; + memset(input_raw, 0, sizeof(input_raw)); + i_type *input = &input_raw[2*16/sizeof(i_type)]; + o_type expected_output[OUTPUT_LEN]; o_type actual_output[OUTPUT_LEN]; tap_type taps[MAX_TAPS]; diff --git a/gnuradio-core/src/lib/filter/qa_gr_fir_scc.cc b/gnuradio-core/src/lib/filter/qa_gr_fir_scc.cc index 1aea34fb..21e0da60 100644 --- a/gnuradio-core/src/lib/filter/qa_gr_fir_scc.cc +++ b/gnuradio-core/src/lib/filter/qa_gr_fir_scc.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002 Free Software Foundation, Inc. + * Copyright 2002,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -106,7 +106,10 @@ test_random_io (fir_maker_t maker) const int OUTPUT_LEN = 17; const int INPUT_LEN = MAX_TAPS + OUTPUT_LEN; - i_type input[INPUT_LEN]; + i_type input_raw[INPUT_LEN + 4*16/sizeof(i_type)]; + memset(input_raw, 0, sizeof(input_raw)); + i_type *input = &input_raw[2*16/sizeof(i_type)]; + o_type expected_output[OUTPUT_LEN]; o_type actual_output[OUTPUT_LEN]; tap_type taps[MAX_TAPS]; diff --git a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.cc b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.cc index 63654a28..a4deafb9 100644 --- a/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.cc +++ b/gnuradio-core/src/lib/filter/qa_gri_mmse_fir_interpolator.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002 Free Software Foundation, Inc. + * Copyright 2002,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -25,6 +25,7 @@ #include #include #include +#include #define NELEM(x) (sizeof (x) / sizeof (x[0])) @@ -41,7 +42,10 @@ void qa_gri_mmse_fir_interpolator::t1 () { static const unsigned N = 100; - float input[N + 10]; + + float input_raw[N + 10 + 4*16/sizeof(float)]; + memset(input_raw, 0, sizeof(input_raw)); + float *input = &input_raw[2*16/sizeof(float)]; for (unsigned i = 0; i < NELEM(input); i++) input[i] = test_fcn ((double) i);