Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1435209rwi; Wed, 19 Oct 2022 10:30:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM69xYZJOwi07wVdjX2tCRzoCEaHhgsfJS7yN1YlsuRdOH/ZY1rbI1DjC+MOwsg6AvF46s4L X-Received: by 2002:a05:6402:428a:b0:42e:8f7e:1638 with SMTP id g10-20020a056402428a00b0042e8f7e1638mr8661969edc.228.1666200650613; Wed, 19 Oct 2022 10:30:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666200650; cv=none; d=google.com; s=arc-20160816; b=l9qLFVNncl4f+AA+sbgd67YB4arcavxjOMv+5SR2y9RHncQZTVSACoPmebJmLQVj4S x4vBPHxD19Nsn3ssaqJ4r51JERilvz42rvQNhHsJpBPumvV0mCHyAU17L1iLIgPgeLLP g5gjLFrpWxiaGMUD2yFbzhDxM5bIQDZnm3yNiKZbsL7IF5JCKMOXzbJBQgX0fdIpizu/ 3Ld4QOuh8sM6skL5VTEaUwj0lIhJdtFuG5jH6kKdyokjG+EwT4xulXXTlFVFaQV0tbf8 PeuDo2+1r3jj2wo4ukAH5PFpduaC3dXc/LBoRMdPjGhAy8/Q8shywOtev6BFzVJAqv3j 8FyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=KQxzROgST2+8KIjtVZdr5+s36xe/ZTzSg3ETS6Z3ulQ=; b=OfHI6AO3lBuH7PWkdvTa8tQFTTYFGiMqi1BarBWTplKuRVJtl/8vmHTqrjbbyDjEKb bq6tpMTeXvpalPXntx3KQpApb1l8kN2+1qPLoNQyeJjA9tMGmKIQiEFc+yuvukXRVx6v SPAh0gC/E76cWgyIDIZplafG4Rt3VFPGA62N2w+aZVpsdxpeu4L8hdrqfhx+5+tXP7d4 x5VFrjZGS2qeNOUlDb9yeU6GhXQGeQGniU4qGKYTMDVVKgCstYWIY20jBF+2M5pLvht2 0G3qanutnuRNezcsF/QqXYzxM8rYkR4jgGzbvicXUwHaZ2RNZKS7hrqVpbiLJfz0Hd/y +4jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=LHMjzMXA; 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 cr17-20020a170906d55100b007800b181a0csi14748250ejc.300.2022.10.19.10.30.02; Wed, 19 Oct 2022 10:30:50 -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; dkim=pass header.i=@linux-foundation.org header.s=google header.b=LHMjzMXA; 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 S230183AbiJSROt (ORCPT + 99 others); Wed, 19 Oct 2022 13:14:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230127AbiJSROn (ORCPT ); Wed, 19 Oct 2022 13:14:43 -0400 Received: from mail-oa1-x2b.google.com (mail-oa1-x2b.google.com [IPv6:2001:4860:4864:20::2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63A673DBFA for ; Wed, 19 Oct 2022 10:14:40 -0700 (PDT) Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-131dda37dddso21507194fac.0 for ; Wed, 19 Oct 2022 10:14:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=KQxzROgST2+8KIjtVZdr5+s36xe/ZTzSg3ETS6Z3ulQ=; b=LHMjzMXASHQR480KuNviD0xWrYZLfPGTCqeVvQUzo3gve/gy/NSntm2Y3IkOnCwj1p +2IyuKYK8OWw/x9y83GLy2MuG6uqB0UvRc95PvRt9RDfj9DT+fECM5grlCAHIYJa4yIC pJNjoJ+eCxvdc3VlvJicxtqeqtYoTOSjDGAh0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KQxzROgST2+8KIjtVZdr5+s36xe/ZTzSg3ETS6Z3ulQ=; b=2cL3bTdnV27htx78reTvbs9ebppH98eARPYohZZi5us588xme1gzGBAw5n32R30uiK ZX4ww3AC8WS1Nf6hCOxL2j+rY9Wkg0MpDSB2RRm4LExLr6+4kGgoBVvEJqwFfN2JEGQK jCzMMfNu3kQqaLNuuUiOGVIRu91SXdLVQ9ETUeAbl1TunI2DbKrxbIwxzxWgjY3YGZvi fQNHekOQRSdtn54ycEJxG0MAXaMiH6ZI66Ge4mnZxupahlcYpeqaR9eSRKbocXNZr3p2 8rPthdcsUMMTXoY5h+ILX/4KDu+Rve0U6jkdNBet+5mfxc+8zJJo1WLCgo3tm+WQW9Gk /cWg== X-Gm-Message-State: ACrzQf2DVrSdOTj5xvVFQp557otWzoG0nSWEREykV3dWywFgfrhf6V6s fLS7BPQBLLxHBQ3qpoU+CTYiV/d5o7ancg== X-Received: by 2002:a05:6870:70a8:b0:131:9591:3eec with SMTP id v40-20020a05687070a800b0013195913eecmr22562934oae.100.1666199679453; Wed, 19 Oct 2022 10:14:39 -0700 (PDT) Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com. [209.85.167.181]) by smtp.gmail.com with ESMTPSA id 94-20020a9d0de7000000b006619295af60sm7217235ots.70.2022.10.19.10.14.36 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Oct 2022 10:14:37 -0700 (PDT) Received: by mail-oi1-f181.google.com with SMTP id x188so20011674oig.5 for ; Wed, 19 Oct 2022 10:14:36 -0700 (PDT) X-Received: by 2002:a05:6808:23c3:b0:351:4ecf:477d with SMTP id bq3-20020a05680823c300b003514ecf477dmr5072747oib.126.1666199676600; Wed, 19 Oct 2022 10:14:36 -0700 (PDT) MIME-Version: 1.0 References: <20221019162648.3557490-1-Jason@zx2c4.com> <20221019165455.GL25951@gate.crashing.org> In-Reply-To: <20221019165455.GL25951@gate.crashing.org> From: Linus Torvalds Date: Wed, 19 Oct 2022 10:14:20 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kbuild: treat char as always signed To: Segher Boessenkool 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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 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. 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. For example, it suddenly starts warning if you *are* being careful, and explicitly use 'unsigned char array[]' things to avoid any sign issues, and then want to do simple and straightforward things with said array (like doing a 'strcmp()' on it). Seriously, -Wpointer-sign is not just useless, it's actively _evil_. The fact that you suggest that clearly means that you've never used it. Linus