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

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Ok so with -O the difference is in between x86_64 and i586:

i586:
Visiting statement:
p_3 = &b + 2147483649;
which is likely CONSTANT
Lattice value changed to CONSTANT &MEM[(void *)&b + 2147483649B].  Adding SSA
edges to worklist.
marking stmt to be not simulated again

x86_64:
Visiting statement:
p_3 = &b + 9223372036854775809;
which is likely CONSTANT
Lattice value changed to CONSTANT &MEM[(void *)&b + -9223372036854775807B]. 
Adding SSA edges to worklist.
marking stmt to be not simulated again

It's for reduced test-case:

#define SMAX   __PTRDIFF_MAX__

void foo(void)
{
  char *p;
  char *p2;
  char b[1];
  char c[1];

  p = b + SMAX; /* pointer overflow check is needed */
  p = b;

  p = b - SMAX; /* pointer overflow check is needed */
  p2 = p + SMAX; /* b: pointer overflow check is needed */
}

Hope it's correct, thus I'll disable cycling of optimizations.
Jakub?

Reply via email to