Hartmut Birr wrote:
Hi,
I was always the opinion that the examination of a test condition stops
if the result can not change again. A test condition like this:
if (pointer == NULL || pointer->member == 0)
should never access pointer->member if pointer is zero. Compared with
the code above, it is possible that gcc build the result from the right
side of the OR statement. This may hit a page fault. Is this a bug in gcc?
It should definitely not dereference if it's NULL. The conditions should
be checked from left to right in this case, no matter how much was
optimized.
Thomas