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 1A5E4C10F1B for ; Wed, 21 Dec 2022 19:08:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234581AbiLUTIa (ORCPT ); Wed, 21 Dec 2022 14:08:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234663AbiLUTI1 (ORCPT ); Wed, 21 Dec 2022 14:08:27 -0500 Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC5A221800 for ; Wed, 21 Dec 2022 11:08:25 -0800 (PST) Received: by mail-qt1-x82c.google.com with SMTP id a16so14413583qtw.10 for ; Wed, 21 Dec 2022 11:08:25 -0800 (PST) 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=Qn+t8qDtNQ9Zc5y1ZpPtqZOcEJkis56LzveCTgnEvi8=; b=VG2RhAC4GerNWJVwD5eJK2dJtjzxa5jl2ZE1QCuq5JVGE55Nw9FULecqOtzxRwYK6X 6x1WsybFrqNdJhT41JDls6OTcVcDuZilELmRIQWqu4uWpTYScMFpjXEAVirA2mY2wWZC BFqQ0e6nDcmL/pH5o0U4mrpND+AVZUnqI15hA= 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=Qn+t8qDtNQ9Zc5y1ZpPtqZOcEJkis56LzveCTgnEvi8=; b=hql24qQlosLh+br3ujcJHXbY5j5z9dzTAPVzqpK5Yh5HCIoeLd/+xqKbsG81zb1c5W USLU1SeJK6iN/PspqHBRP1n5BYajU65ggert+KYJQPK8v4VeK1JIu4/47JacZcNh53Xy GU6Zq2Fu/919tc7M8q2/yMeXBivI87x/OOl51w8kjWJDfAgvuTwpNsih2WpymheU5hs8 eJtKc8TR8Z/kKt/QowOyhryEuB0hpCH7gKmaR9ChZ8nusaa74g80Pr8aQFJeJwhoz8yC aexWgCj13jCNmbM8FRKsSgaLNgFhifMj83VOnI7PCdVTiJskfFSISIenWpJDzpEQWEH3 n50w== X-Gm-Message-State: AFqh2krcK80sHvPmfvht/RsBV1PDmNG7m/+b5tZ9K5vsysIkhKzh+E2f Yokg7d9HNuNW6czdu2jcXNVuCuARe7VMa1F6 X-Google-Smtp-Source: AMrXdXuZYAdnB3H46bfT7Jlk8KSlOLls1/7ed9AF5APxN1dK5Ny0HmkD5Uk3WvjyNXANf4LzQb3cLg== X-Received: by 2002:ac8:4519:0:b0:3a9:763b:4a6d with SMTP id q25-20020ac84519000000b003a9763b4a6dmr3767294qtn.10.1671649704830; Wed, 21 Dec 2022 11:08:24 -0800 (PST) Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com. [209.85.219.48]) by smtp.gmail.com with ESMTPSA id f7-20020ac84707000000b00397b1c60780sm9536251qtp.61.2022.12.21.11.08.21 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Dec 2022 11:08:22 -0800 (PST) Received: by mail-qv1-f48.google.com with SMTP id h10so10937717qvq.7 for ; Wed, 21 Dec 2022 11:08:21 -0800 (PST) X-Received: by 2002:a05:6214:1185:b0:4c6:608c:6b2c with SMTP id t5-20020a056214118500b004c6608c6b2cmr133347qvv.130.1671649701297; Wed, 21 Dec 2022 11:08:21 -0800 (PST) MIME-Version: 1.0 References: <20221019203034.3795710-1-Jason@zx2c4.com> <20221221145332.GA2399037@roeck-us.net> <1a27385c-cca6-888b-1125-d6383e48c0f5@prevas.dk> <20221221155641.GB2468105@roeck-us.net> <20221221171922.GA2470607@roeck-us.net> In-Reply-To: From: Linus Torvalds Date: Wed, 21 Dec 2022 11:08:05 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] kbuild: treat char as always unsigned To: Guenter Roeck Cc: Rasmus Villemoes , Geert Uytterhoeven , "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 , linux-m68k@lists.linux-m68k.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-toolchains@vger.kernel.org On Wed, Dec 21, 2022 at 10:46 AM Linus Torvalds wrote: > > But it looked very obvious indeed, and I hate having buggy code that > is architecture-specific when we have generic code that isn't buggy. Side note: we have an x86-64 implementation that looks fine (but not really noticeably better than the generic one) that is based on the 'return subtraction' model. But it seems to get it right. And we have a 32-bit x86 assembly thing that is based on 'rep scasb', that then uses the carry bit to also get things right. That 32-bit asm goes back to Linux 0.01 (with some changes since to use "sbbl+or" instead of a conditional neg). I was playing around a lot with the 'rep' instructions back when, since it was all part of "learn the instruction set" for me. Both of them should probably be removed as pointless too, but they don't seem actively buggy. Linus