[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#4078) test001 fails on sparcv9

Howard Chu writes:
> Could be. If it's an alignment issue, this diff ought to fix it:
> +       Operation *op;
> +       char opbuf[OPERATION_BUFFER_SIZE];
...followed by op = (Operation *)opbuf;

This is still buggy, the compiler is free to align opbuf any
way it wants.  To ensure correct alignment, use something like:

	typedef union {
		Operation *op;
	} Operation_buffer;
	Operation_buffer opbuf;
	Operation *op = (Operation *) opbuf;

'grep OPERATION_BUFFER_SIZE *.c */*.c' finds 15 such places to fix.

(Actually I'm not entirely sure even that code is strictly correct under
C99's anal aliasing rules, but if not I think it is an issue for a C99
defect report rather than an OpenLDAP ITS.)