1 /* { dg-do compile } */ 2 /* { dg-options "-Wall -O3" } */ 3 4 typedef __SIZE_TYPE__ size_t; 5 6 struct S { 7 int *p0, *p1, *p2; 8 sizeS9 size_t size () const { return p1 - p0; } 10 fS11 void f (size_t n) { 12 if (n > size ()) // can't happen because 13 foo (n - size ()); // n is in [1, MIN(size() - 1, 3)] 14 else if (n < size ()) 15 bar (p0 + n); 16 } 17 fooS18 void foo (size_t n) 19 { 20 size_t left = (size_t)(p2 - p1); 21 if (left >= n) 22 __builtin_memset (p2, 0, n * sizeof *p2); // { dg-bogus "maximum object size" } 23 24 } 25 26 void bar (int*); 27 }; 28 f(S & s)29void f (S &s) 30 { 31 size_t n = s.size (); 32 if (n > 1 && n < 5) 33 s.f (n - 1); 34 } 35