Manfred Spraul <[EMAIL PROTECTED]> writes:
> I've asked the question on the gcc devel list. The first reply was that 
> MemSet violates strict aliasing rules:

No doubt it does, but that is not really the issue here; the issue IMHO
is whether there is any real risk involved.  Remember that the macro is
really of the form

        if (blah blah)
                // unsafe code is here

Given that gcc is smart enough not to move any code across the memset()
call, I doubt that it would be moving anything across the whole if()
construct.  Now if the if-condition were such that the memset code path
could be optimized away, then we'd have a problem, but in practice I do
not believe gcc is smart enough to realize that the alignment check is
always true.

We do have to be wary of MemSetAligned and MemSetLoop, but these are
only used in constrained places (routines that do nothing else with
the memory in question) so I think they are not a problem.

> I think we must either add -fno-strict-aliasing, or switch to the c 
> compiler memset functions for gcc.

We will not be doing the latter, for certain.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Reply via email to