public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/58101] New: Wrong out-of-bounds warning under -Os
@ 2013-08-07 18:31 llozano at google dot com
  2013-08-07 22:54 ` [Bug middle-end/58101] " llozano at google dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: llozano at google dot com @ 2013-08-07 18:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58101
           Summary: Wrong out-of-bounds warning under -Os
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: llozano at google dot com

The following test case generates a wrong "out-of-bounds" warning. 
This problem only happens under -Os

gcc test.i -c -Os -Werror -Wall

 In function ‘rcu_init_lal’:
/home/llozano/trash/min_rcutree.i:17:13: error: array subscript is above array
bounds [-Werror=array-bounds]
   rsp->level[i] = rsp->level[i - 1] + rsp->levelcnt[i - 1];

rcu_num_levels is never larger than 1. So the code inside the loop is never
executed. 

test.i:
---
extern int rcu_num_lvls;
int rcu_num_lvls = 1;

struct rcu_node {
};

struct rcu_state {
 struct rcu_node *level[1];
 int levelcnt[4 + 1];
};

void rcu_init_lal(struct rcu_state *rsp)
{
 int i;

 for (i = 1; i < rcu_num_lvls; i++)
  rsp->level[i] = rsp->level[i - 1] + rsp->levelcnt[i - 1];
}
>From gcc-bugs-return-427523-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Aug 07 18:39:32 2013
Return-Path: <gcc-bugs-return-427523-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 23980 invoked by alias); 7 Aug 2013 18:39:32 -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 23888 invoked by uid 48); 7 Aug 2013 18:39:29 -0000
From: "meissner at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/12081] Gcc can't be compiled with -mregparm=3
Date: Wed, 07 Aug 2013 18:39:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: other
X-Bugzilla-Version: 3.3.1
X-Bugzilla-Keywords: build
X-Bugzilla-Severity: normal
X-Bugzilla-Who: meissner at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: rask at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-12081-4-uzTdsnEEmj@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-12081-4@http.gcc.gnu.org/bugzilla/>
References: <bug-12081-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: 2013-08/txt/msg00447.txt.bz2
Content-length: 1032

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

Michael Meissner <meissner at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |meissner at gcc dot gnu.org

--- Comment #27 from Michael Meissner <meissner at gcc dot gnu.org> ---
The patch from Oleg Endo breaks the PowerPC build.

.../gcc/config/rs6000/rs6000.c: In function ‘void rs6000_emit_swdiv(rtx_def*,
rtx_def*, rtx_def*, bool)’:
.../gcc/config/rs6000/rs6000.c:28142: error: invalid cast from type ‘const
insn_gen_fn’ to type ‘rtx_def* (*)(rtx_def*, rtx_def*, rtx_def*)’
.../gcc/config/rs6000/rs6000.c: In function ‘void rs6000_emit_swrsqrt(rtx_def*,
rtx_def*)’:
.../gcc/config/rs6000/rs6000.c:28220: error: invalid cast from type ‘const
insn_gen_fn’ to type ‘rtx_def* (*)(rtx_def*, rtx_def*, rtx_def*)’
>From gcc-bugs-return-427524-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Aug 07 18:57:43 2013
Return-Path: <gcc-bugs-return-427524-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 24660 invoked by alias); 7 Aug 2013 18:57:43 -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 24555 invoked by uid 48); 7 Aug 2013 18:57:40 -0000
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/12081] Gcc can't be compiled with -mregparm=3
Date: Wed, 07 Aug 2013 18:57:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: other
X-Bugzilla-Version: 3.3.1
X-Bugzilla-Keywords: build
X-Bugzilla-Severity: normal
X-Bugzilla-Who: ubizjak at gmail dot com
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: rask at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-12081-4-lc4cG0QB1N@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-12081-4@http.gcc.gnu.org/bugzilla/>
References: <bug-12081-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: 2013-08/txt/msg00448.txt.bz2
Content-length: 904

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

--- Comment #28 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Michael Meissner from comment #27)
> The patch from Oleg Endo breaks the PowerPC build.
> 
> .../gcc/config/rs6000/rs6000.c: In function ‘void
> rs6000_emit_swdiv(rtx_def*, rtx_def*, rtx_def*, bool)’:
> .../gcc/config/rs6000/rs6000.c:28142: error: invalid cast from type ‘const
> insn_gen_fn’ to type ‘rtx_def* (*)(rtx_def*, rtx_def*, rtx_def*)’
> .../gcc/config/rs6000/rs6000.c: In function ‘void
> rs6000_emit_swrsqrt(rtx_def*, rtx_def*)’:
> .../gcc/config/rs6000/rs6000.c:28220: error: invalid cast from type ‘const
> insn_gen_fn’ to type ‘rtx_def* (*)(rtx_def*, rtx_def*, rtx_def*)’

Patch at [1].

[1] http://gcc.gnu.org/ml/gcc-patches/2013-08/msg00323.html
>From gcc-bugs-return-427525-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Aug 07 19:22:35 2013
Return-Path: <gcc-bugs-return-427525-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 798 invoked by alias); 7 Aug 2013 19:22:35 -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 658 invoked by uid 48); 7 Aug 2013 19:22:32 -0000
From: "olegendo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/12081] Gcc can't be compiled with -mregparm=3
Date: Wed, 07 Aug 2013 19:22:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: other
X-Bugzilla-Version: 3.3.1
X-Bugzilla-Keywords: build
X-Bugzilla-Severity: normal
X-Bugzilla-Who: olegendo at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: rask at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-12081-4-7xEw7WRcdC@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-12081-4@http.gcc.gnu.org/bugzilla/>
References: <bug-12081-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: 2013-08/txt/msg00449.txt.bz2
Content-length: 1242

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

--- Comment #29 from Oleg Endo <olegendo at gcc dot gnu.org> ---
(In reply to Uroš Bizjak from comment #28)
> (In reply to Michael Meissner from comment #27)
> > The patch from Oleg Endo breaks the PowerPC build.
> > 
> > .../gcc/config/rs6000/rs6000.c: In function ‘void
> > rs6000_emit_swdiv(rtx_def*, rtx_def*, rtx_def*, bool)’:
> > .../gcc/config/rs6000/rs6000.c:28142: error: invalid cast from type ‘const
> > insn_gen_fn’ to type ‘rtx_def* (*)(rtx_def*, rtx_def*, rtx_def*)’
> > .../gcc/config/rs6000/rs6000.c: In function ‘void
> > rs6000_emit_swrsqrt(rtx_def*, rtx_def*)’:
> > .../gcc/config/rs6000/rs6000.c:28220: error: invalid cast from type ‘const
> > insn_gen_fn’ to type ‘rtx_def* (*)(rtx_def*, rtx_def*, rtx_def*)’
> 
> Patch at [1].
> 
> [1] http://gcc.gnu.org/ml/gcc-patches/2013-08/msg00323.html

Fixed on trunk.

http://gcc.gnu.org/viewcvs/gcc?view=revision&revision=201580

    PR other/12081
    config/rs6000/rs6000.c (gen_2arg_fn_t): Remove typedef.
    (rs6000_emit_swdiv, rs6000_emit_swrsqrt): Don't cast result of GEN_FCN
    to gen_2arg_fn_t.
>From gcc-bugs-return-427526-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Aug 07 19:26:56 2013
Return-Path: <gcc-bugs-return-427526-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 8303 invoked by alias); 7 Aug 2013 19:26: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 8201 invoked by uid 55); 7 Aug 2013 19:26:54 -0000
From: "meissner at linux dot vnet.ibm.com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/12081] Gcc can't be compiled with -mregparm=3
Date: Wed, 07 Aug 2013 19:26:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: other
X-Bugzilla-Version: 3.3.1
X-Bugzilla-Keywords: build
X-Bugzilla-Severity: normal
X-Bugzilla-Who: meissner at linux dot vnet.ibm.com
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Priority: P2
X-Bugzilla-Assigned-To: rask at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-12081-4-YvpgmkWNcL@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-12081-4@http.gcc.gnu.org/bugzilla/>
References: <bug-12081-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: 2013-08/txt/msg00450.txt.bz2
Content-length: 1586

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

--- Comment #30 from Michael Meissner <meissner at linux dot vnet.ibm.com> ---
On Wed, Aug 07, 2013 at 07:22:32PM +0000, olegendo at gcc dot gnu.org wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12081
> 
> --- Comment #29 from Oleg Endo <olegendo at gcc dot gnu.org> ---
> (In reply to Uroš Bizjak from comment #28)
> > (In reply to Michael Meissner from comment #27)
> > > The patch from Oleg Endo breaks the PowerPC build.
> > > 
> > > .../gcc/config/rs6000/rs6000.c: In function ‘void
> > > rs6000_emit_swdiv(rtx_def*, rtx_def*, rtx_def*, bool)’:
> > > .../gcc/config/rs6000/rs6000.c:28142: error: invalid cast from type ‘const
> > > insn_gen_fn’ to type ‘rtx_def* (*)(rtx_def*, rtx_def*, rtx_def*)’
> > > .../gcc/config/rs6000/rs6000.c: In function ‘void
> > > rs6000_emit_swrsqrt(rtx_def*, rtx_def*)’:
> > > .../gcc/config/rs6000/rs6000.c:28220: error: invalid cast from type ‘const
> > > insn_gen_fn’ to type ‘rtx_def* (*)(rtx_def*, rtx_def*, rtx_def*)’
> > 
> > Patch at [1].
> > 
> > [1] http://gcc.gnu.org/ml/gcc-patches/2013-08/msg00323.html
> 
> Fixed on trunk.
> 
> http://gcc.gnu.org/viewcvs/gcc?view=revision&revision=201580
> 
>     PR other/12081
>     config/rs6000/rs6000.c (gen_2arg_fn_t): Remove typedef.
>     (rs6000_emit_swdiv, rs6000_emit_swrsqrt): Don't cast result of GEN_FCN
>     to gen_2arg_fn_t.

Great, thanks.  I was just starting the build process to verify it.
>From gcc-bugs-return-427527-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Aug 07 19:44:48 2013
Return-Path: <gcc-bugs-return-427527-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 1141 invoked by alias); 7 Aug 2013 19:44:47 -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 1051 invoked by uid 48); 7 Aug 2013 19:44:44 -0000
From: "richard-gccbugzilla at metafoo dot co.uk" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58102] New: rejects valid initialization of constexpr object with mutable member
Date: Wed, 07 Aug 2013 19:44:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: richard-gccbugzilla at metafoo dot co.uk
X-Bugzilla-Status: UNCONFIRMED
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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-58102-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: 2013-08/txt/msg00451.txt.bz2
Content-length: 850

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

            Bug ID: 58102
           Summary: rejects valid initialization of constexpr object with
                    mutable member
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: richard-gccbugzilla at metafoo dot co.uk

Given

  struct S {
    mutable int n;
    constexpr S() : n() {}
  };

GCC correctly accepts:

  constexpr S s {};

but incorrectly rejects:

  constexpr S s = {};

saying:

<stdin>: At global scope:
<stdin>:5:20: error: ‘const S’ cannot be the type of a complete constant
expression because it has mutable sub-objects

Per core issue 1405, both the above cases are valid.
>From gcc-bugs-return-427529-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Aug 07 20:27:56 2013
Return-Path: <gcc-bugs-return-427529-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 7062 invoked by alias); 7 Aug 2013 20:27: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 6927 invoked by uid 48); 7 Aug 2013 20:27:51 -0000
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/54864] Decltype in nested class
Date: Wed, 07 Aug 2013 20:27: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: 4.8.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: paolo.carlini at oracle dot com
X-Bugzilla-Status: RESOLVED
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: bug_status resolution
Message-ID: <bug-54864-4-r33SDpJsXn@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-54864-4@http.gcc.gnu.org/bugzilla/>
References: <bug-54864-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: 2013-08/txt/msg00453.txt.bz2
Content-length: 506

http://gcc.gnu.org/bugzilla/show_bug.cgi?idT864

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Closing as invalid: http://gcc.gnu.org/ml/gcc-patches/2013-08/msg00398.html


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

* [Bug middle-end/58101] Wrong out-of-bounds warning under -Os
  2013-08-07 18:31 [Bug c/58101] New: Wrong out-of-bounds warning under -Os llozano at google dot com
@ 2013-08-07 22:54 ` llozano at google dot com
  2013-08-08  6:41 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: llozano at google dot com @ 2013-08-07 22:54 UTC (permalink / raw)
  To: gcc-bugs

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

Luis A Lozano <llozano at google dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |major

--- Comment #1 from Luis A Lozano <llozano at google dot com> ---
Raising priority of this issue. 
This problem was found while build the ChromOS linux kernel. 
Most probably this will be found by other platfroms using the linux kernel.


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

* [Bug middle-end/58101] Wrong out-of-bounds warning under -Os
  2013-08-07 18:31 [Bug c/58101] New: Wrong out-of-bounds warning under -Os llozano at google dot com
  2013-08-07 22:54 ` [Bug middle-end/58101] " llozano at google dot com
@ 2013-08-08  6:41 ` mpolacek at gcc dot gnu.org
  2013-08-08 20:46 ` llozano at google dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-08-08  6:41 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Perhaps a dup of PR41847.  Fails even with -O2, -O3, -Ofast, no only -Os. 
-fno-tree-vrp makes it go away...


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

* [Bug middle-end/58101] Wrong out-of-bounds warning under -Os
  2013-08-07 18:31 [Bug c/58101] New: Wrong out-of-bounds warning under -Os llozano at google dot com
  2013-08-07 22:54 ` [Bug middle-end/58101] " llozano at google dot com
  2013-08-08  6:41 ` mpolacek at gcc dot gnu.org
@ 2013-08-08 20:46 ` llozano at google dot com
  2014-04-08 15:24 ` dichlofos-mv at yandex dot ru
  2021-12-23  6:36 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: llozano at google dot com @ 2013-08-08 20:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Luis A Lozano <llozano at google dot com> ---
(In reply to Marek Polacek from comment #2)
> Perhaps a dup of PR41847.  Fails even with -O2, -O3, -Ofast, no only -Os. 
> -fno-tree-vrp makes it go away...

I dont think it is a duplicate of this issue. 
This problem does not happen with GCC 4.7.2


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

* [Bug middle-end/58101] Wrong out-of-bounds warning under -Os
  2013-08-07 18:31 [Bug c/58101] New: Wrong out-of-bounds warning under -Os llozano at google dot com
                   ` (2 preceding siblings ...)
  2013-08-08 20:46 ` llozano at google dot com
@ 2014-04-08 15:24 ` dichlofos-mv at yandex dot ru
  2021-12-23  6:36 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: dichlofos-mv at yandex dot ru @ 2014-04-08 15:24 UTC (permalink / raw)
  To: gcc-bugs

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

Mikhail Veltishchev <dichlofos-mv at yandex dot ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dichlofos-mv at yandex dot ru

--- Comment #4 from Mikhail Veltishchev <dichlofos-mv at yandex dot ru> ---
Luis, why do you state that "rcu_num_levels is never larger than 1", this
cannot be proved as this variable is not const and can change its value (e.g.
in another thread).


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

* [Bug middle-end/58101] Wrong out-of-bounds warning under -Os
  2013-08-07 18:31 [Bug c/58101] New: Wrong out-of-bounds warning under -Os llozano at google dot com
                   ` (3 preceding siblings ...)
  2014-04-08 15:24 ` dichlofos-mv at yandex dot ru
@ 2021-12-23  6:36 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-23  6:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Further reduced:
int a [1];

void foo (int n)
{
   if (n <= 1) return;
   int i = 1;
   a [i] = a [i - 1];
}

This is one of these false positives warning where we should maybe not warn but
instead just change the code to be a trap.

Note in the original testcase, GCC is able to remove the loop and just change
it to one statement. That is part of the reason for the warning even.

clang does not warn about the above because they only warn for the literal a[1]
case.

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

end of thread, other threads:[~2021-12-23  6:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-07 18:31 [Bug c/58101] New: Wrong out-of-bounds warning under -Os llozano at google dot com
2013-08-07 22:54 ` [Bug middle-end/58101] " llozano at google dot com
2013-08-08  6:41 ` mpolacek at gcc dot gnu.org
2013-08-08 20:46 ` llozano at google dot com
2014-04-08 15:24 ` dichlofos-mv at yandex dot ru
2021-12-23  6:36 ` pinskia 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).