On Thu, Mar 26, 2015 at 10:32:18AM +0100, Richard Biener wrote:
> I think I simply didn't want to change more testcases at that point,
> but I can't see how followup passes at the very point wouldn't
> clean things up very quickly (via fre or copyprop).  Eventually
> it was -Og and pass_fold_builtins interaction (thinking of
> __builtin_constant_p (__builtin_object_size (...)) or so).
> If so I'm sure I added a testcase.

Can't find such a testcase.
Anyway, the shorter version of the patch regresses:

struct S { char a[10]; char b[10]; };
int
foo (int x)
{
  struct S s;
  char *p = &s.a[4];
  if (x)
    p += 1;
  return __builtin_constant_p (__builtin_object_size (p, 1));
}

with -Og, while it works with the longer version.

Though, say for
  return __builtin_constant_p (__builtin_object_size (p, 1) + 1);

we already return 0 for -Og (and not -O2) already in 4.9.

        Jakub

Reply via email to