Hi Guys,
I just found an issue in kernel code and thought we must have a compilation warning for such cases.
Submitted a bug here:
https://bugs.launchpad.net/gcc-linaro/+bug/1064218
Problem description: -------------------------
When we have following declaration:
struct foo { char array[5]; .... };
And have a definition like:
struct foo foo_abc = { .array = "12345", };
Problem here is: size of array is 5 bytes and so we can actually add a string with four characters only to it, as '\0' will take an additional space.
But with my definition of foo_abc.. i had 5 characters + '\0'... that will make it 6 and that will overflow the array..
What will actually happen here? - compiler will not add '\0' at all? -or it will go outside of boundaries of array?
-- viresh