[Bug c/29468] New: off-by-one error for string initialiser warning
debian-gcc at lists dot debian dot org
gcc-bugzilla@gcc.gnu.org
Sat Oct 14 12:12:00 GMT 2006
[forwarded from http://bugs.debian.org/392880]
$ gcc t.c
t.c:10: warning: initializer-string for array of chars is too long
#include <stdio.h>
char a[]="a";
char string1[2] = "";
char b[]="b";
char string2[2] = "1";
char c[]="c";
char string3[2] = "12"; /* no warning here */
char d[]="d";
char string4[2] = "123";
char e[]="e";
int main()
{
puts(string1);
puts(string2);
puts(string3);
puts(string4);
return 0;
}
--
Summary: off-by-one error for string initialiser warning
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: debian-gcc at lists dot debian dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29468
More information about the Gcc-bugs
mailing list