public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "siddhesh at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/64739] New: Spurious "array subscript is above array bounds" warning
Date: Fri, 23 Jan 2015 07:39:00 -0000	[thread overview]
Message-ID: <bug-64739-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64739

            Bug ID: 64739
           Summary: Spurious "array subscript is above array bounds"
                    warning
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: siddhesh at redhat dot com

Reduced Reproducer:

$ cat foo.c
void
foo (char **inptrp, char *inend, int *wch, int *cnt)
{ 
  int inlen = *cnt & 7;
  if (inlen != 0)
    { 
      char *inptr = *inptrp;
      char bytebuf[4];

      while (inptr < inend)
        bytebuf[inlen++] = *inptr++;

      *cnt = &bytebuf[inlen] - inptr;
      *wch = *inptr;
    }
}

$ gcc -O3 -Wall -o foo.s -S foo.c
foo.c: In function ‘foo’:
foo.c:11:16: warning: array subscript is above array bounds [-Warray-bounds]
         bytebuf[inlen++] = *inptr++;
                ^

The warning disappears when one adds -fno-tree-vrp to the compile command.

The actual error appears when building the iconv bits in glibc.
>From gcc-bugs-return-474491-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Jan 23 08:13:57 2015
Return-Path: <gcc-bugs-return-474491-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 18486 invoked by alias); 23 Jan 2015 08:13:51 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 18113 invoked by uid 48); 23 Jan 2015 08:13:28 -0000
From: "ebotcazou at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ada/64712] [5 Regression] FAIL: gnat.dg/unchecked_convert1.adb execution test (x86_64/-m32)
Date: Fri, 23 Jan 2015 08:13:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: ada
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ebotcazou at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on everconfirmed
Message-ID: <bug-64712-4-9G61GWvl74@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64712-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64712-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-01/txt/msg02485.txt.bz2
Content-length: 512

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd712

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|2015-01-22 00:00:00         |2015-01-23
     Ever confirmed|0                           |1

--- Comment #7 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
It's an uninitialized local variable.


             reply	other threads:[~2015-01-23  7:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-23  7:39 siddhesh at redhat dot com [this message]
2015-01-23 19:15 ` [Bug tree-optimization/64739] " rth at gcc dot gnu.org
2015-01-26 13:07 ` izamyatin at gmail dot com
2015-01-28 22:15 ` rth at gcc dot gnu.org

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=bug-64739-4@http.gcc.gnu.org/bugzilla/ \
    --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).