List Archive: gentoo-amd64
Note: Due to technical difficulties, the Archives are currently not up to date.
provides an alternative service for most mailing lists.c.f. bug 424647
On 07/01/2011 03:04 AM, Frank Peters wrote:
> On Fri, 01 Jul 2011 02:44:36 +0300
> Nikos Chantziaras<realnc@...> wrote:
>>> Your code is buggy, because you're breaking C's aliasing rules. You are
>>> not allowed to use a different pointer type to dereference a variable of
>>> a different type. Doing so results in undefined behavior.
> Well, the error occurs only within the loop structure. If
> I manually "unroll" the loop using the same pointers there
> is no error when compiled with "O2."
> IOW, the problem is how the loop is optimized under -O2.
When there's "undefined behavior", it really means just that: you cannot
make any assumptions about when the result is going to be correct and
when not. It might as well depend on whether it was raining yesterday.