public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rhajdaj at yahoo dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/13896] New: Initializer string warning not printed if implied NULL-terminator out of bounds
Date: Wed, 28 Jan 2004 13:23:00 -0000	[thread overview]
Message-ID: <20040128132357.13896.rhajdaj@yahoo.com> (raw)

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


             reply	other threads:[~2004-01-28 13:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-28 13:23 rhajdaj at yahoo dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040128132357.13896.rhajdaj@yahoo.com \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).