Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1479402rwi; Wed, 19 Oct 2022 11:05:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7jqo8VjmM3P8ZhRjKU7Vtmk9a2pCjULOeohDjp0KZxqNfpgLdL/XtfA0Ps/Zd+XCntzIhg X-Received: by 2002:a17:906:3e01:b0:781:6462:700f with SMTP id k1-20020a1709063e0100b007816462700fmr7866574eji.307.1666202710748; Wed, 19 Oct 2022 11:05:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666202710; cv=none; d=google.com; s=arc-20160816; b=wdPEZ69bKHgpUmtJtDN/1dOdaGbBWTTYQwCHAZiTjLEZjynrv80nnNyjYr/Ku1Kt6x y0eIqf7Brsucgg4GcYcDzmsSsyk1kTPlnupHYSwHZVtIjGSngPu4USj23RpQ6kcbeTpL MrK8sMyjpfu6isA3Lj4hs9stNXG8Xevffz+Fz+vLflaBq1QxvozXLRc1RPb70XohySee Zd289z5Ur9hDm7i8fec0Wn8YS+AavzqHy7cs/TvNC7SXU5oL4AA8JssBGJqHSF4VdV2P gcjxSzJi4+e7Se7s1AoTqysIavO6iOxbjGQNwQuoH+vqr0ZmtOkLpCH6ktMOos2XL4oy muvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=GxAkE5xmqXERKNlgzUGmpx8QdgQ2IfKANUnU8g7FhaI=; b=u2D1MHCEHpaN0DCBFhhepcFcZonFRrUuZ2zQ3dSI22MWf4IYS3wCLyy6dJBqx6++Qz 68xLoOmuc4kK7grXWbtmwonpOX+t2fm3v01mFxslCBPdLT+bJvg3KoPaaa2QbHArOC4s /hbM8GB8tlum8HGeMxfgKiKtl3ozo1lcqe+aMNC5UTbUuasTxG/WcyuKrVzQUYZPlsHX FpClHWv+K/a++nEplPKO2kkKhBt4cGAH4Y6cLfO8ecJLENBqv6KH4mkrzJhly+gySMCV 5ulBivQQBLa2yz7FUg7KwDKBuSNpc5vjrg4cHWf4WK5V6LiM2trWw6b9mI/aer7xh631 bGoQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xg14-20020a170907320e00b007781bc042a2si16238532ejb.646.2022.10.19.11.04.38; Wed, 19 Oct 2022 11:05:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229922AbiJSRqg (ORCPT + 99 others); Wed, 19 Oct 2022 13:46:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231509AbiJSRqZ (ORCPT ); Wed, 19 Oct 2022 13:46:25 -0400 Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A17531C843D; Wed, 19 Oct 2022 10:46:22 -0700 (PDT) Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 29JHhjS0005682; Wed, 19 Oct 2022 12:43:46 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 29JHhjxm005681; Wed, 19 Oct 2022 12:43:45 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Wed, 19 Oct 2022 12:43:45 -0500 From: Segher Boessenkool To: Linus Torvalds Cc: "Jason A. Donenfeld" , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org, linux-toolchains@vger.kernel.org, Masahiro Yamada , Kees Cook , Andrew Morton , Andy Shevchenko , Greg Kroah-Hartman Subject: Re: [PATCH] kbuild: treat char as always signed Message-ID: <20221019174345.GM25951@gate.crashing.org> References: <20221019162648.3557490-1-Jason@zx2c4.com> <20221019165455.GL25951@gate.crashing.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! On Wed, Oct 19, 2022 at 10:14:20AM -0700, Linus Torvalds wrote: > On Wed, Oct 19, 2022 at 9:57 AM Segher Boessenkool > wrote: > > > > This is an ABI change. It is also hugely detrimental to generated > > code quality on architectures that make the saner choice (that is, have > > most instructions zero-extend byte quantities). > > Yeah, I agree. We should just accept the standard wording, and be > aware that 'char' has indeterminate signedness. And plain "char" is a separate type from "signed char" and "unsigned char" both. > But: > > > Instead, don't actively disable the compiler warnings that catch such > > cases? So start with removing footguns like > > > > # disable pointer signed / unsigned warnings in gcc 4.0 > > KBUILD_CFLAGS += -Wno-pointer-sign > > Nope, that won't fly. > > The pointer-sign thing doesn't actually help (ie it won't find places > where you actually compare a char), and it causes untold damage in > doing completely insane things. When I did this more than a decade ago there indeed was a LOT of noise, mostly caused by dubious code. I do agree many cases detected are not very important, but it also revealed cases where a filesystem's disk format changed (atarifs or amigafs or such iirc) -- many cases it is annoying to be reminded of sloppy code, but in some cases it detects crucial problems. > Seriously, -Wpointer-sign is not just useless, it's actively _evil_. Then suggest something better? Or suggest improvements to the existing warning? This warning is part of -Wall, most people must not have problems with it (or people are so apathetic about this that they have not complained about it). It is easy to improve your code when the compiler detects problems like this. Of course after such a long time of lax code sanity enforcement you get all warnings at once :-/ > The fact that you suggest that clearly means that you've never used > it. Ah, ad hominems. Great. Segher