"Alexei Alexandrov" <[EMAIL PROTECTED]> wrote:
> As far as I understand, this fix will take the problem away only
> because SumCtx is bigger now. But the problem with
> sqlite3_aggregate_context will remain: the pointer returned will not
> be aligned properly if the size of the context is less or equal 32
> bytes. Am I correct?
>
The context should be 8-byte aligned regardless. And after
check-in [3084] there are no long doubles stored in the context
so 8-byte alignment is sufficient - provided of course that you
do not implement your own private aggregate functions that
require a 16-byte aligned context.
The Mem structure does not appear on disk or in any API (except
as the opaque structure pointer sqlite3_value*) so it can be
revised as needed to force 16-byte alignment. Perhaps
the following definition of Mem would work better:
struct Mem {
u16 flags;
u8 type;
u8 enc;
char *z;
int n;
i64 i;
double r;
char zShort[NBFS];
void (*xDel)(void *);
};
Assuming the entire structure is 16-byte aligned and pointers
and integers are all 8-bytes and 8-byte aligned, then there
would be 4 bytes of padding between Mem.enc and Mem.z. This
would result in zShort appearing on a 16-byte boundary, would
it not?
--
D. Richard Hipp <[EMAIL PROTECTED]>