Hi Christopher,
Sorry for the delay. (I didn't get any notification of the bug and I
thought you'd reply to the email.) Anyway, I just pushed a fix. Please
test it.
Thanks for reporting that.
/Patrik
On Thu, Nov 24, 2011 at 6:55 PM, Patrik Jonsson
<code@...> wrote:
> Hi Christopher,
>
> Yeah, found it. It turns out the 1-D index unit-stride evaluator used
> data()+lbound() which is incorrect since data() already points to the
> lbound() object. So they were written into memory at the wrong place,
> which also explains the memory error. This Could you do me a favor and
> add this as a bug in the issue tracker so I can refer to it in the
> commit. Assuming this doesn't break anything else I can push the fix
> asap.
>
> thanks for finding that,
>
> /Patrik
>
> On Wed, Nov 23, 2011 at 11:07 PM, Christopher Subich
> <csubich@...> wrote:
>> I've encountered a bug in the latest hg versions of Blitz, index
>> placeholders are not working properly when an array is non-base-zero.
>> From what I can tell, they begin operating from the "zero element" of
>> the array rather than the base, and this will lead to out-of-bounds
>> memory writes.
>>
>> This error is not caught by -DBZ_DEBUG.
>>
>> Test code:
>>
>> int main() {
>> Array<double,1> bar(3); // c-Array
>> Array<double,1> qux(3,fortranArray); // fortran
>> Array<double,1> foo(Range(5,7)); // custom
>> blitz::firstIndex ii;
>> // Indexed assignment from 0
>> bar = ii;
>> cout << bar;
>> // FortranArray
>> qux = ii;
>> cout << qux;
>> // Indexed assignment on non-base-0
>> foo = ii;
>> cout << foo;
>> return 0;
>> }
>>
>> Expected output (older version of Blitz, $Id: indexexpr.h,v 1.7
>> 2005/05/07 04:17:56 julianc Exp $)
>> (0,2)
>> [ 0 1 2 ]
>> (1,3)
>> [ 1 2 3 ]
>> (5,7)
>> [ 5 6 7 ]
>>
>>
>> Current output: (hg checkout on 23 Nov 2011)
>> (0,2)
>> [ 0 1 2 ]
>> (1,3)
>> [ 0 1 2 ]
>> (5,7)
>> [ 0 0 0 ]
>>
>> Those last two assignments also cause memory errors. Valgrind will
>> scream, and re-ordering the source statements can cause a segfault.
>>
>> I'm not too familiar with the innards of Blitz, so I can't begin to
>> debug this myself. Unfortunately, this bug is a show-stopper for me
>> since my code relies on the proper working of this bit.
>>
>> ------------------------------------------------------------------------------
>> All the data continuously generated in your IT infrastructure
>> contains a definitive record of customers, application performance,
>> security threats, fraudulent activity, and more. Splunk takes this
>> data and makes sense of it. IT sense. And common sense.
>> http://p.sf.net/sfu/splunk-novd2d
>> _______________________________________________
>> Blitz-support mailing list
>> Blitz-support@...
>> https://lists.sourceforge.net/lists/listinfo/blitz-support
>>
|