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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61133C43219 for ; Wed, 19 Oct 2022 17:14:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230041AbiJSROq (ORCPT ); Wed, 19 Oct 2022 13:14:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230118AbiJSROn (ORCPT ); Wed, 19 Oct 2022 13:14:43 -0400 Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD24960C98 for ; Wed, 19 Oct 2022 10:14:39 -0700 (PDT) Received: by mail-ot1-x32b.google.com with SMTP id a14-20020a9d470e000000b00661b66a5393so9877682otf.11 for ; Wed, 19 Oct 2022 10:14:39 -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=DotRjYFY/0jPEtR0ReZwUwaek+JKc8TXpUDKNhHsoG9hVhPrs1oh0aECPj9o2AAp8V Fg5Gx31nPfv/U99AZnkjfcxBRdTcLtpT3aHGi2rqDcqcoMAX8vdqgHDwNc0FuZ3W/0En ShoF/cyIc86Hxh8UNBIX6T/lsBOUROfvsztT3Ljcepkwq3ELj7WTCcjdnBLYXaCEbEqf 1b5LslmS9nvDIAQTAKAypyDOJJW8HVrPvuVkGOabhjzqGEoAqc/O/kQqI94yMgkwB3lL vFG2nZ7cp6urFsrtOzqTLyskHtZK4xvfVWSXdB0aLDuNgfdE4/MQmGRk/qQbSoeBgXg/ ab5A== X-Gm-Message-State: ACrzQf2hV4R8GSJprwS1e/c+IVy3BLsEXcvzepQi23nWvZneWvauV6Bm H0PjczMDP+Md1OoV1VgmaD96EYT4mKnMJg== X-Google-Smtp-Source: AMsMyM5twGak28SE4OryqHb8/AGudYI6VL/DkmCd3F1Yf56MO4l9avpZ7UR/W7frWv8vQEaiSrBFYQ== X-Received: by 2002:a05:6830:660c:b0:661:bc04:7486 with SMTP id cp12-20020a056830660c00b00661bc047486mr4527378otb.152.1666199678896; Wed, 19 Oct 2022 10:14:38 -0700 (PDT) Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com. [209.85.167.180]) by smtp.gmail.com with ESMTPSA id q30-20020a4a88e1000000b004805e9e9f3dsm6774956ooh.1.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-f180.google.com with SMTP id p127so19330814oih.9 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" Precedence: bulk List-ID: X-Mailing-List: linux-toolchains@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