From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C591D386F023; Mon, 20 Apr 2020 19:42:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C591D386F023 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587411731; bh=LVUOoKhB36E7g+JPkftqyf7Vzlqb5x/jUeQtRj7TGwY=; h=From:To:Subject:Date:From; b=OZ+Ulod1CDpfNbALhoyFiFc88juFunvkXz5KWAfFd6jUCFIwdncSUGLcfp2Kmp6N4 DrMXzqqbMHucDRnPnS78t5rocQuKZQ5kVgXuot52l4xBMuyFvkL533p79uPW7biUb0 3xj9W4D7ZpT2gh7ZbpSDnkzKg6RyIPHZNCtsLju0= From: "chantry.xavier at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/94675] New: [9 regression] -Warray-bounds false positive with -O2 Date: Mon, 20 Apr 2020 19:42:11 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: chantry.xavier at gmail dot com X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created 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-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Apr 2020 19:42:11 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94675 Bug ID: 94675 Summary: [9 regression] -Warray-bounds false positive with -O2 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: chantry.xavier at gmail dot com Target Milestone: --- Created attachment 48319 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D48319&action=3Dedit test case Tested with gcc 9.1 9.2 and 9.3 on godbolt. Compiling with "-O2 -Warray-bounds" gives the following false positive : --- : In function 'f': :38:11: warning: array subscript 7 is outside array bounds of 'byte= [1]' {aka 'unsigned char[1]'} [-Warray-bounds] 38 | ps->s +=3D len; | ^~ :46:6: note: while referencing 'c' 46 | byte c; | ^ Compiler returned: 0 --- Error also with -O3 but not with -O. Note that the error goes after removing the assert.=