[Bug middle-end/54945] Too strong non-aliasing analysis?

gcc at robbertkrebbers dot nl gcc-bugzilla@gcc.gnu.org
Thu Oct 18 15:59:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54945

--- Comment #12 from gcc at robbertkrebbers dot nl 2012-10-18 15:59:00 UTC ---
What do you mean by invalid? It is certainly not undefined behavior. The
pointer "&x + 1" is allowed by (6.5.6p8 of C11), and the equality operator
should behave as follows (6.5.9 of C11):

  ... or one is a pointer to one past
  the end of one array object and the
  other is a pointer to the start of a
  different array object that happens
  to immediately follow the first array
  object in the address space.

Taking the issues and the response of defect report #260

  http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_260.htm

into account, I would say (but dr#260 does not directly say so) it may even
non-deterministically yield 0 or 1. Therefore, the behavior of gcc would be
reasonable to me.



More information about the Gcc-bugs mailing list