From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8013 invoked by alias); 3 Dec 2013 15:50:34 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 6662 invoked by uid 48); 3 Dec 2013 15:49:31 -0000 From: "dnovillo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/59377] New: VRP produces bogus warning with -Warray-bounds Date: Tue, 03 Dec 2013 15:50:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 4.8.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dnovillo at gcc dot gnu.org 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 cf_gcchost cf_gcctarget cf_gccbuild Message-ID: 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-12/txt/msg00195.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D59377 Bug ID: 59377 Summary: VRP produces bogus warning with -Warray-bounds Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: dnovillo at gcc dot gnu.org Host: x86_64-unknown-linux-gnu Target: x86_64-unknown-linux-gnu Build: x86_64-unknown-linux-gnu Using trunk and 4.8.x, this code produces a bogus -Warray-bounds warning: typedef decltype(sizeof(void*)) size_t; size_t strlen(const char *); int memcmp (const void *, const void *, size_t); struct StringPiece { const char *ptr_; size_t size_; StringPiece (); StringPiece (const char *p1):ptr_ (p1), size_(strlen(p1)) { } const char *data () { return ptr_; } size_t length() { return size_; } }; void operator=3D=3D (StringPiece, StringPiece p2) { const char *a =3D p2.data (), *b =3D a; if (p2.length() > 8) { b +=3D 8; memcmp (a, b, 1); } } void UtilsSplitQuotedStrings () { StringPiece c; c =3D=3D ""; } $ trunk/bld/bin/g++ -std=3Dc++11 -c -Warray-bounds -O2 a.cc a.cc: In function =E2=80=98void UtilsSplitQuotedStrings()=E2=80=99: a.cc:22:23: warning: array subscript is above array bounds [-Warray-bounds] memcmp (a, b, 1); $ ^ The warning disappears with -fno-tree-vrp: $ trunk/bld/bin/g++ -std=3Dc++11 -c -Warray-bounds -O2 a.cc -fno-tree-vrp $ I've seen some similar looking bug reports, but none seemed related with VR= P. >>From gcc-bugs-return-436541-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Dec 03 15:53:54 2013 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 12210 invoked by alias); 3 Dec 2013 15:53:54 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 12178 invoked by uid 48); 3 Dec 2013 15:53:51 -0000 From: "ppluzhnikov at google dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/59377] VRP produces bogus warning with -Warray-bounds Date: Tue, 03 Dec 2013 15:53:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 4.8.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ppluzhnikov at google dot com 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: Message-ID: In-Reply-To: References: 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-12/txt/msg00196.txt.bz2 Content-length: 146 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59377 --- Comment #1 from Paul Pluzhnikov --- Google ref: b/7233326