I tested the code you are using on PSoC5.
#define MAX_ARRAY 16 /* Line 1 */
int array[MAX_ARRAY]; /* Line 2 */
int a = array [MAX_ARRAY]; /* Line 3 */
In Line 3, the Square Braces is used around 'MAX_ARRAY'.
The compilation gives a warning stating that variable 'a' is unused.
I executed the code in 'Debug' mode
In GCC, a variable declared as int is allocated 32bits, whereas in Keil it is allocated 16 bits.
When the memory window was observed, the variable 'a' was updated with a value which is subsequent to the location of the array declared.
As you have mentioned there is no error or warning message about the out of bound of the array during build.
Thank you for your reply.
My sample code is not correct, yours is correct.
I found out that if I use optimization level (Release mode), GCC will give warning about subscript out of range.
GCC won't give warning if optimization turn off.
Thanks for sharing the info.