public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/13896] New: Initializer string warning not printed if implied NULL-terminator out of bounds
@ 2004-01-28 13:23 rhajdaj at yahoo dot com
  2004-01-28 13:58 ` [Bug c/13896] " schwab at suse dot de
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: rhajdaj at yahoo dot com @ 2004-01-28 13:23 UTC (permalink / raw)
  To: gcc-bugs

If the following string array is declared,

char a[][3] = {{"Hello"}, {"Hi"}};

the following warning will be printed when the source file is compiled:
warning: initializer-string for array of chars is too long
warning: (near initialization for `a[0]')

If the array is changed to this,

char a[][3] = {{"Hel"}, {"Hi"}};

no warning is printed.  But of course a[1][0] ('H') overwrites the NULL-
terminator at a[0][3], so a[0] prints as "HelHi".  A warning should be printed 
for this.

-- 
           Summary: Initializer string warning not printed if implied NULL-
                    terminator out of bounds
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rhajdaj at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13896


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2004-05-19 21:44 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-28 13:23 [Bug c/13896] New: Initializer string warning not printed if implied NULL-terminator out of bounds rhajdaj at yahoo dot com
2004-01-28 13:58 ` [Bug c/13896] " schwab at suse dot de
2004-01-28 14:20 ` bangerth at dealii dot org
2004-01-28 14:42 ` schwab at suse dot de
2004-01-28 14:47 ` bangerth at dealii dot org
2004-01-28 15:26 ` schwab at suse dot de
2004-01-28 15:52 ` bangerth at dealii dot org
2004-01-28 16:37 ` pinskia at gcc dot gnu dot org
2004-01-28 16:52 ` rhajdaj at yahoo dot com
2004-01-28 16:56 ` pinskia at gcc dot gnu dot org
2004-01-28 17:35 ` schwab at suse dot de
2004-01-28 18:13 ` rhajdaj at yahoo dot com
2004-01-29  1:17 ` pinskia at gcc dot gnu dot org
2004-01-29 11:23 ` rhajdaj at yahoo dot com
2004-05-20 20:23 ` trav at mac dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).