1 /* { dg-do compile } */ 2 /* { dg-additional-options "-fno-sanitize=hwaddress -fsanitize=kernel-hwaddress" } */ 3 4 5 /* Defaults to check for kernel-hwaddress. 6 1) No stack tagging => no calls to __hwasan_tag_memory. 7 2) No block scope tagging (same again). 8 3) Use sanitize-recover by default (everything ends in noabort). */ 9 int __attribute__ ((noinline)) accessing_pointers(int * left,int * right)10accessing_pointers (int *left, int *right) 11 { 12 int x = right[2]; 13 left[3] = right[1]; 14 return right[1] + left[2]; 15 } 16 17 int __attribute__ ((noinline)) using_stack(int num)18using_stack (int num) 19 { 20 int big_array[10]; 21 int other_array[20]; 22 accessing_pointers(other_array, big_array); 23 return big_array[num]; 24 } 25 26 #ifndef ARG 27 #define ARG 0 28 #endif 29 int __attribute__ ((noinline)) main()30main () 31 { 32 using_stack (ARG); 33 return 0; 34 } 35 36 /* { dg-final { scan-assembler-not "__hwasan_tag_memory" } } */ 37 /* { dg-final { scan-assembler-not "__hwasan_(load|store)\\d(?!_noabort)" } } */ 38