On 2/9/16, Stephan Beal <[email protected]> wrote: > On Tue, Feb 9, 2016 at 12:51 PM, Richard Hipp <[email protected]> wrote: > >> On 2/9/16, Warren Young <[email protected]> wrote: >> > I was getting this from “fossil stash” for no obvious reason: >> > >> > fossil: ./src/delta.c:231: checksum: Assertion `(z - (const unsigned >> > char*)0)%4==0' failed. >> >> I wish you could reproduce this, because that is an important >> assertion and I would really like to chase this to ground. >> > > Out of curiosity: what is the purpose of the type cast for the 0/NULL? > > i've never seen that construct before except when required for overload > disambiguation in C++.
The assert() is checking to ensure that its input buffer has the correct alignment to allow the content to be access as an array of 32-bit integers. Accessing the input as an array of integers would work regardless on Intel, but other platforms (ARM, Sparc) have stricter alignment requirements. The input to checksum() should normally be a pointer to a buffer obtained from malloc(). And such buffers should always be 8-byte aligned (or 4-byte aligned on Windows). So I'm not sure how this is happening. There must be some path somewhere in Fossil whereby delta_create() or delta_apply() is called with a pointer into the middle of an allocated buffer, rather than a pointer to the beginning of the buffer. Any help in tracking down that call is appreciated. -- D. Richard Hipp [email protected] _______________________________________________ fossil-users mailing list [email protected] http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

