From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2196FC05027 for ; Fri, 20 Jan 2023 11:42:59 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1pIpnM-0004xW-Uq; Fri, 20 Jan 2023 11:42:56 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pIpnL-0004xQ-Hv for linux-f2fs-devel@lists.sourceforge.net; Fri, 20 Jan 2023 11:42:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:Content-Type:MIME-Version :In-Reply-To:References:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=e8FecXcOocV24EzXGtkpJ8Dhj7SttAoq1+DWjNIDOoY=; b=Zx6m9+OfVZGn4KtduLvqVGVwcr mEKVSE3HndRj3zVpuw9Cqq0rYMvu+9xqIc8KEASMEHU5VZvXo31ey86hPlfqMKTsJfoM/iTjQmS1m bvkQ6Rq2mNBbvJ9jqd9yidX7DWv8M7z7JvgvreMiBZhVDd1HN9hZ7vL6fWGanMIgYNwY=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:Content-Type:MIME-Version:In-Reply-To: References:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=e8FecXcOocV24EzXGtkpJ8Dhj7SttAoq1+DWjNIDOoY=; b=loofY380wC5EF4N/V00pEp8hjO 1kjqKn3H2785K9x5z2gI84+Qe9Dtom4PLX0p/y9XKZlRE4DVRn7leYYF7RXuujCzccd67SGkybDRK vPTGD9qXVKRd4Nb0w1LglGDm3FesuLMDOIR+NheCJ7UP04xwn5oOH11heniUi5/7vtJY=; Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1pIpnI-00A8fX-EK for linux-f2fs-devel@lists.sourceforge.net; Fri, 20 Jan 2023 11:42:54 +0000 Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-129-4gsduPDlOrGmwEjdKMB1gA-1; Fri, 20 Jan 2023 11:42:44 +0000 X-MC-Unique: 4gsduPDlOrGmwEjdKMB1gA-1 Received: from AcuMS.Aculab.com (10.202.163.4) by AcuMS.aculab.com (10.202.163.4) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 20 Jan 2023 11:42:42 +0000 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.044; Fri, 20 Jan 2023 11:42:42 +0000 From: David Laight To: 'Segher Boessenkool' , Rob Landley Thread-Topic: Calculating array sizes in C - was: Re: Build regressions/improvements in v6.2-rc1 Thread-Index: AQHZLL5SlbpKhYJiU02AbZRDtfTmb66nLCYA Date: Fri, 20 Jan 2023 11:42:42 +0000 Message-ID: <931141d03e8748cebad42aff1a508d7f@AcuMS.aculab.com> References: <3800eaa8-a4da-b2f0-da31-6627176cb92e@physik.fu-berlin.de> <429140e0-72fe-c91c-53bc-124d33ab5ffa@physik.fu-berlin.de> <0d238f02-4d78-6f14-1b1b-f53f0317a910@physik.fu-berlin.de> <1732342f-49fe-c20e-b877-bc0a340e1a50@fu-berlin.de> <0f51dac4-836b-0ff2-38c6-5521745c1c88@landley.net> <20230120105341.GI25951@gate.crashing.org> In-Reply-To: <20230120105341.GI25951@gate.crashing.org> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US X-Headers-End: 1pIpnI-00A8fX-EK Subject: Re: [f2fs-dev] Calculating array sizes in C - was: Re: Build regressions/improvements in v6.2-rc1 X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-xtensa@linux-xtensa.org" , Arnd Bergmann , "linux-sh@vger.kernel.org" , "Michael.Karcher" , John Paul Adrian Glaubitz , "linux-wireless@vger.kernel.org" , "linux-mips@vger.kernel.org" , "amd-gfx@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" , Geert Uytterhoeven , "kasan-dev@googlegroups.com" , Michael Karcher , "linux-f2fs-devel@lists.sourceforge.net" , "linuxppc-dev@lists.ozlabs.org" , "linux-arm-kernel@lists.infradead.org" , "linux-media@vger.kernel.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net From: Segher Boessenkool > Sent: 20 January 2023 10:54 ... > > > I suggest to file a bug against gcc complaining about a "spurious > > > warning", and using "-Werror -Wno-error-sizeof-pointer-div" until gcc is > > > adapted to not emit the warning about the pointer division if the result > > > is not used. > > Yeah. If the first operand of a conditional operator is non-zero, the > second operand is not evaluated, and if the first is zero, the third > operand is not evaluated. It is better if we do not warn about > something we do not evaluate. In cases like here where it is clear at > compile time which branch is taken, that shouldn't be too hard. > > Can someone please file a GCC PR? With reduced testcase preferably. It's not a bug. All the operands of the conditional operator have to be valid. It might be that the optimiser can discard one, but that happens much later on. Even the operands of choose_expr() have to be valid - but can have different types. I'm not sure what the code is trying to do or why it is failing. Was it a fail in userspace - where the option to allow sizeof (void) isn't allowed. FWIW you can check for a compile-time NULL (or 0) with: #define is_null(x) (sizeof *(0 : (void *)(x) ? (int *)0) != 1) Although that is a compile-time error for non-NULL unless 'void *' arithmetic is allowed. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales) _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel