https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85315

--- Comment #4 from rguenther at suse dot de <rguenther at suse dot de> ---
On April 10, 2018 4:50:49 PM GMT+02:00, "msebor at gcc dot gnu.org"
<gcc-bugzi...@gcc.gnu.org> wrote:
>https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85315
>
>Martin Sebor <msebor at gcc dot gnu.org> changed:
>
>           What    |Removed                     |Added
>----------------------------------------------------------------------------
>              CC|                            |msebor at gcc dot gnu.org
>
>--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
>A simpler test case that shows the same optimization opportunity is:
>
>  int f (int i)
>  {
>    extern int x;
>    int y;
>    return &y + i == &x;
>  }
>
>A test case that both Clang and GCC get wrong is below.  (This will be
>discussed at the next WG14 meeting -- see
>http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2222.htm#q23-can-one-do-comparison-between-pointers-to-objects-of-compatible-types-with-different-provenances-that-are-not-strictly-within-their-original-allocations)
>
>  int g (int i)
>  {
>    int x, y, z;
>
>    int *p = &x + i;
>    int *q = &y;
>
>    return p == q;
>  }

If you eventually expect a true result then please no - this should be
undefined.

Reply via email to