public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52954] New: Missing bounds check warning
@ 2012-04-12 21:55 xinliangli at gmail dot com
  2012-04-12 21:56 ` [Bug c++/52954] " xinliangli at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: xinliangli at gmail dot com @ 2012-04-12 21:55 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52954
           Summary: Missing bounds check warning
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: xinliangli@gmail.com


int foo() {
  int arr[100];
  // ...
 return arr[100];
 }

 /*  From clang:

 array.cpp:4:10: warning: array index 100 is past the end of the array
(which contains 100 elements) [-Warray-bounds]
 return arr[100];
        ^   ~~~
array.cpp:2:3: note: array 'arr' declared here
 int arr[100];
 ^
1 warning generated.

*/


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

* [Bug c++/52954] Missing bounds check warning
  2012-04-12 21:55 [Bug c++/52954] New: Missing bounds check warning xinliangli at gmail dot com
@ 2012-04-12 21:56 ` xinliangli at gmail dot com
  2012-04-13  9:52 ` [Bug c++/52954] Missing bounds check warning without optimization rguenth at gcc dot gnu.org
  2015-07-24 21:52 ` manu at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: xinliangli at gmail dot com @ 2012-04-12 21:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from davidxl <xinliangli at gmail dot com> 2012-04-12 21:56:07 UTC ---
Another example:

constexpr int arr_size = 42;
 constexpr int N = 44;
 void f(int);
 int test() {
   int arr[arr_size];
  // ...
   f(arr[N]);
   // ...
  if (N < arr_size) return arr[N];
  return 0;
 }

/*

deadcode.cpp:7:5: warning: array index 44 is past the end of the array
(which contains 42 elements) [-Warray-bounds]
 f(arr[N]);
   ^   ~
deadcode.cpp:5:3: note: array 'arr' declared here
 int arr[arr_size];
 ^
1 warning generated.

*/


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

* [Bug c++/52954] Missing bounds check warning without optimization
  2012-04-12 21:55 [Bug c++/52954] New: Missing bounds check warning xinliangli at gmail dot com
  2012-04-12 21:56 ` [Bug c++/52954] " xinliangli at gmail dot com
@ 2012-04-13  9:52 ` rguenth at gcc dot gnu.org
  2015-07-24 21:52 ` manu at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-04-13  9:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-04-13
            Summary|Missing bounds check        |Missing bounds check
                   |warning                     |warning without
                   |                            |optimization
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-04-13 09:51:38 UTC ---
We only perform array-bounds warnings when we optimize and the VRP pass is
turned on.  We completely miss this kind of warning in the frontend(s),
though they for sure can only detect very simple cases.


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

* [Bug c++/52954] Missing bounds check warning without optimization
  2012-04-12 21:55 [Bug c++/52954] New: Missing bounds check warning xinliangli at gmail dot com
  2012-04-12 21:56 ` [Bug c++/52954] " xinliangli at gmail dot com
  2012-04-13  9:52 ` [Bug c++/52954] Missing bounds check warning without optimization rguenth at gcc dot gnu.org
@ 2015-07-24 21:52 ` manu at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu.org @ 2015-07-24 21:52 UTC (permalink / raw)
  To: gcc-bugs

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |manu at gcc dot gnu.org
         Resolution|---                         |DUPLICATE

--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Duplicate

*** This bug has been marked as a duplicate of bug 3587 ***
>From gcc-bugs-return-493282-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Jul 24 21:52:53 2015
Return-Path: <gcc-bugs-return-493282-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 74290 invoked by alias); 24 Jul 2015 21:52:53 -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 74198 invoked by uid 48); 24 Jul 2015 21:52:49 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug bootstrap/3587] [arc-elf] GCC 3.0-CVS multilib problem
Date: Fri, 24 Jul 2015 21:52:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: bootstrap
X-Bugzilla-Version: 3.0
X-Bugzilla-Keywords: build
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Resolution: DUPLICATE
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-3587-4-W4ZyM0EnXn@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-3587-4@http.gcc.gnu.org/bugzilla/>
References: <bug-3587-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-07/txt/msg02173.txt.bz2
Content-length: 484

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xinliangli at gmail dot com

--- Comment #11 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
*** Bug 52954 has been marked as a duplicate of this bug. ***
>From gcc-bugs-return-493283-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Jul 24 21:52:56 2015
Return-Path: <gcc-bugs-return-493283-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 74647 invoked by alias); 24 Jul 2015 21:52:56 -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 74250 invoked by uid 48); 24 Jul 2015 21:52:51 -0000
From: "andrew.n.sutton at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/66962] [concepts] overloaded function causing memory blow-up and ICE
Date: Fri, 24 Jul 2015 21:52:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: c++-concepts
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: andrew.n.sutton at gmail dot com
X-Bugzilla-Status: NEW
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-66962-4-2TBPoNVegm@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66962-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66962-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-07/txt/msg02172.txt.bz2
Content-length: 1054

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

--- Comment #13 from Andrew Sutton <andrew.n.sutton at gmail dot com> ---
There are a couple of other problems in the minimized example (concept int
shows up a couple of times, there's a variable template whose initializer is a
requires expression). I doubt those contribute to the observed problem.

I suspect there's something else at work. There was a performance problem
related earlier this year where (either) normalization or decomposition was
being applied for each subexpression multiple times.

The total number of elements in a decomposition should be linear w.r.t. to the
number of disjunctions. I'll try to look through this tomorrow.

A possible optimization is to store specializations of each concept being
normalized, so we don't expand to the same expressions over and over again --
basically, helping to ensure that we don't have lots of duplicate cases that
we're proving over and over again. It would probably be a good idea to prove
that's logically sound before implementing :/


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

end of thread, other threads:[~2015-07-24 21:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-12 21:55 [Bug c++/52954] New: Missing bounds check warning xinliangli at gmail dot com
2012-04-12 21:56 ` [Bug c++/52954] " xinliangli at gmail dot com
2012-04-13  9:52 ` [Bug c++/52954] Missing bounds check warning without optimization rguenth at gcc dot gnu.org
2015-07-24 21:52 ` manu at gcc dot gnu.org

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).