summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Warray-bounds-42.c
blob: 005e1459dfa34edfb57f781542f8605d9c7946ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* PR tree-optimization/89720 - Spurious -Warray-bounds warning on a range
   with max < min
   { dg-do compile }
   { dg-options "-O2 -Wall" } */

void f (char*, int);

#if __SIZEOF_POINTER__ == 8

void g (__INT64_TYPE__ i)
{
  char a[65536] = "";
  char *p = a + (i & (__INT64_TYPE__)0xffffffff3fffffffLL);
  f (p, *(p - 6));            /* { dg-bogus "\\\[-Warray-bounds" } */
}

#elif __SIZEOF_POINTER__ == 4

void h (__INT32_TYPE__ i)
{
  char a[65536] = "";
  char *p = a + (i & (__INT32_TYPE__)0x8fffffffLL);
  f (p, *(p - 6));            /* { dg-bogus "\\\[-Warray-bounds" } */
}

#endif