public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/53198] [4.6/4.7 Regression] gcc wrongly emits "array subscript is above array bounds" for simple arrays
Date: Thu, 03 May 2012 10:47:00 -0000	[thread overview]
Message-ID: <bug-53198-4-SzjQ3iPRCo@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-53198-4@http.gcc.gnu.org/bugzilla/>

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-05-03
          Component|c                           |tree-optimization
            Summary|[4.6 Regression] gcc        |[4.6/4.7 Regression] gcc
                   |wrongly emits "array        |wrongly emits "array
                   |subscript is above array    |subscript is above array
                   |bounds" for simple arrays   |bounds" for simple arrays
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-05-03 10:46:30 UTC ---
Confirmed.  This is because of loop header copying doing

<bb 2>:
  D.1711_8 = devices[0];
  if (D.1711_8 != 0B)
    goto <bb 3>;
  else
    goto <bb 5>;

<bb 3>:
  i_7 = 0;

<bb 4>:
  # i_9 = PHI <0(3), i_4(4)>
  i_4 = i_9 + 1;
  D.1711_3 = devices[i_4];
  if (D.1711_3 != 0B)
    goto <bb 4>;
  else
    goto <bb 5>;

thus VRP sees that the access in the loop uses indices of [1, INF] which
is out-of bounds.  In 4.8 we recognize that the loop can only run once
(because of the initializer size) and optimize the variable array access
away.


  parent reply	other threads:[~2012-05-03 10:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-02 18:35 [Bug c/53198] New: [4.6 " vapier at gentoo dot org
2012-05-02 19:06 ` [Bug c/53198] " manu at gcc dot gnu.org
2012-05-03 10:47 ` rguenth at gcc dot gnu.org [this message]
2012-05-29 14:33 ` [Bug tree-optimization/53198] [4.6/4.7 " rguenth at gcc dot gnu.org
2012-07-16  7:28 ` Petr.Salinger at seznam dot cz
2012-10-23 22:33 ` manu at gcc dot gnu.org
2012-12-18 15:16 ` rguenth at gcc dot gnu.org
2013-04-12 15:16 ` [Bug tree-optimization/53198] [4.7 " jakub at gcc dot gnu.org
2013-10-14 10:14 ` Emmanuel.Thome at inria dot fr
2013-10-14 10:43 ` paolo.carlini at oracle dot com
2014-06-12 13:07 ` rguenth 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-53198-4-SzjQ3iPRCo@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).