From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9F04539D1C1B; Thu, 12 Nov 2020 02:18:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9F04539D1C1B From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/97424] Warn on invalid shift amount after inlining Date: Thu, 12 Nov 2020 02:18:34 +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: 11.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: cvs-commit at gcc dot gnu.org 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: Message-ID: In-Reply-To: References: 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: Thu, 12 Nov 2020 02:18:34 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97424 --- Comment #4 from CVS Commits --- The master branch has been updated by David Malcolm : https://gcc.gnu.org/g:5e00ad3ffbfb4df7242c313a0d836f5b538eb2fb commit r11-4930-g5e00ad3ffbfb4df7242c313a0d836f5b538eb2fb Author: David Malcolm Date: Wed Nov 11 21:16:45 2020 -0500 analyzer: warn on invalid shift counts [PR97424] This patch implements -Wanalyzer-shift-count-negative and -Wanalyzer-shift-count-overflow, analogous to the C/C++ warnings -Wshift-count-negative and -Wshift-count-overflow, but implemented via interprocedural path analysis rather than via parsing in a front end, and thus capable of detecting interprocedural cases that the warnings implemented in the front ends can miss. gcc/analyzer/ChangeLog: PR tree-optimization/97424 * analyzer.opt (Wanalyzer-shift-count-negative): New. (Wanalyzer-shift-count-overflow): New. * region-model.cc (class shift_count_negative_diagnostic): New. (class shift_count_overflow_diagnostic): New. (region_model::get_gassign_result): Complain about shift counts that are negative or are >=3D the operand's type's width. gcc/ChangeLog: PR tree-optimization/97424 * doc/invoke.texi (Static Analyzer Options): Add -Wno-analyzer-shift-count-negative and -Wno-analyzer-shift-count-overflow. (-Wno-analyzer-shift-count-negative): New. (-Wno-analyzer-shift-count-overflow): New. gcc/testsuite/ChangeLog: PR tree-optimization/97424 * gcc.dg/analyzer/invalid-shift-1.c: New test.=