1/* Test -f*sanitize*=all */ 2/* { dg-do run } */ 3/* { dg-skip-if "" { *-*-* } { "*" } { "-O2" } } */ 4/* { dg-skip-if "" { *-*-* } { "-flto -fno-fat-lto-objects" } } */ 5/* { dg-options "-fsanitize=undefined,float-cast-overflow,float-divide-by-zero -fno-sanitize=all -fdump-tree-optimized" } */ 6 7int a[4]; 8 9int 10f1 (int x, int y, int z) 11{ 12 return a[x] + (1 << y) + (100 / z); 13} 14 15char * 16f2 (int x) 17{ 18 char *p = (char *) __builtin_calloc (64, 1); 19 p[x] = 3; 20 return p; 21} 22 23int 24f3 (int x, int *y, double z, double w) 25{ 26 int a[*y]; 27 if (x) 28 __builtin_unreachable (); 29 asm volatile ("" : : "r" (&a[0])); 30 return z / w; 31} 32 33int 34main () 35{ 36 return 0; 37} 38 39/* { dg-final { scan-tree-dump-not "__ubsan_" "optimized" } } */ 40/* { dg-final { scan-tree-dump-not "UBSAN_CHECK_" "optimized" } } */ 41/* { dg-final { cleanup-tree-dump "optimized" } } */ 42