Previously when manipulating an array, I can go over the array bounds and I know that C is lenient. Now when I access a value that out of those boundaries, I get an error [-Warray-bounds] and it prevents me from diving into memory. Code:
#include <stdio.h>
int main(void)
{
int arr[] = {1,2,3,4,5};
printf("arr [0] is %d
", arr[0]);
printf("arr[10] is %d
", arr[10]);
}
errors:
address.c:12:31: warning: array index 10 is past the end of the array (which contains 5 elements) [-Warray-bounds]
printf("arr[10] is %d
", arr[10]);
Is that something new in a compiler, and if yes, how can I disable or enable it?