Query: What happens in case of char array overflow?

2012-10-09 Thread Viresh Kumar
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 arra

Re: Query: What happens in case of char array overflow?

2012-10-09 Thread Viresh Kumar
Hi, Thanks for your quick response. On 9 October 2012 13:39, wrote: > Viresh Kumar wrote: >> When we have following declaration: >> >> struct foo { >> char array[5]; >> >> }; >> >> And have a definition like:

Re: Query: What happens in case of char array overflow?

2012-10-09 Thread Viresh Kumar
On 9 October 2012 13:47, Christophe Lyon wrote: > [copy of my answer in your bug report] > > Hello, > > If you look at the assembly code generated by the compiler, you will see: > foo_abc: > .ascii "12345" > > From the gas documentation: > `.ascii' expects zero or more string literals (*note Stri

Re: Query: What happens in case of char array overflow?

2012-10-09 Thread Viresh Kumar
On 9 October 2012 17:13, Mans Rullgard wrote: > This is what the C99 standard says: > > An array of character type may be initialized by a character string > literal, optionally enclosed in braces. Successive characters of the > character string literal (including the terminating null charac