From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from movementarian.org ([178.79.150.28]:44116 "EHLO movementarian.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726994AbfKLAPi (ORCPT ); Mon, 11 Nov 2019 19:15:38 -0500 Received: from movement by movementarian.org with local (Exim 4.92.3) (envelope-from ) id 1iUIzj-0005DM-Hs for smatch@vger.kernel.org; Mon, 11 Nov 2019 23:21:15 +0000 Date: Mon, 11 Nov 2019 23:21:15 +0000 From: John Levon Subject: check_signed.c false negative Message-ID: <20191111232115.GA19963@movementarian.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: smatch-owner@vger.kernel.org List-ID: To: smatch@vger.kernel.org Given: enum ib_qp_state { IB_QPS_RESET, IB_QPS_INIT, IB_QPS_RTR, IB_QPS_RTS, IB_QPS_SQD, IB_QPS_SQE, IB_QPS_ERR }; int p(enum ib_qp_state cur_state, enum ib_qp_state next_state) { #if 0 if (cur_state < 0 || cur_state > IB_QPS_ERR || next_state < 0 || next_state > IB_QPS_ERR) { return (5); } #else if (next_state < 0 || next_state > IB_QPS_ERR) { return (5); } #endif return (0); } current smatch is happy. But "#if 1" above instead, and: jlevon@sent:~/src/smatch$ ./smatch a.c ./smatch: a.c:15 p() warn: unsigned 'cur_state' is never less than zero. Why is "next_state" not reported equally? thanks john