Path: utzoo!utgpu!watmath!uunet!ginosko!uakari.primate.wisc.edu!xanth!mcnc!sps From: sps@mcnc.org (Stephen P. Schaefer) Newsgroups: gnu.gcc.bug Subject: typedef const char foo[]; broken Message-ID: Date: 7 Oct 89 22:24:43 GMT Sender: daemon@mcnc.org Distribution: gnu Organization: Microelectronics Center of North Carolina Lines: 42 GCC 1.36 on Sun OS 4.0.1, constructed from the diffs obtained from prep.ai.mit.edu. Please note the incorrect output generated when printing the 40 character + null string. The problem does not occur when the strng1 declaration is replaced with ``const char strng1[]''. The problem does not occur at all with GCC 1.36 on a VAX running 4.3BSD. The message ``warning: initializer-string for array of chars is too long'' does not appear when the problem string is a 32 character + null. If this restriction cannot be removed, then I ask that the ``warning'' be intensified into an error. I'm curious about how this happens. Thanks for a great compiler! I can work around this. underdog:sps:349 gcc -v toosmall.c gcc version 1.36 /usr/local/std/lib/gcc-cpp -v -undef -D__GNUC__ -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ toosmall.c /usr/tmp/cca09127.cpp GNU CPP version 1.36 /usr/local/std/lib/gcc-cc1 /usr/tmp/cca09127.cpp -quiet -dumpbase toosmall.c -version -o /usr/tmp/cca09127.s GNU C version 1.36 (sparc) compiled by GNU C version 1.36. default target switches: -mfpu -mepilogue toosmall.c:3: warning: initializer-string for array of chars is too long /usr/local/std/lib/gcc-as -o toosmall.o /usr/tmp/cca09127.s ld -e start -dc -dp /lib/crt0.o toosmall.o /usr/local/std/lib/gcc-gnulib -lc underdog:sps:350 ./a.out 1234567890123456789012345678901 12345678901234567890123456789012%s underdog:sps:351 cat toosmall.c typedef const char foo[]; foo strng = "1234567890123456789012345678901"; foo strng1 = "1234567890123456789012345678901234567890"; main() { printf("%s\n", strng); printf("%s\n", strng1); } underdog:sps:352 -- Stephen P. Schaefer, Postmaster MCNC sps@mcnc.org P.O. Box 12889 ...!mcnc!sps RTP, NC 27709