Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3684946rwb; Sun, 9 Oct 2022 09:13:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7zyhfG39Kwqc/IzGiPItLoWAiY7Ykc9TydO/5/EZxb+0tuBxiFlOaTqn+XVCtzMEC9nG+4 X-Received: by 2002:a63:6b83:0:b0:460:c07c:553b with SMTP id g125-20020a636b83000000b00460c07c553bmr5447691pgc.209.1665332018849; Sun, 09 Oct 2022 09:13:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665332018; cv=none; d=google.com; s=arc-20160816; b=w3VJrHknEk8zUK25lspJhio372X8i3jHrx5q/0qTezNjG1f+/dcZBI/vYwsHl09bGc 7cr9ZZRHH3xZeq0UgLszTpQBJNRr6vyuVqR0xvplMaqbjP/VaEeisJr+6UTtSjr9wj2W dKwk3W/073NpqaWjHb438MZvZ9G2b/6tbSbgAGa0QcXIx5a6CMa0AigmHYFVCoCCycJV knbpYynJ6NRiGzzWSt8qxrJocrpKE5d91zifpe1iOh+dKZXbHx6HmQFvgyUp5FqcMWJJ EQ8eYgHBrkqUG76I4zY6wRwowJrc/Kf6nzRoTK4wcvns7J0PDC3ITP4P8P5rPc/aUVKb fYVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=7nRMSkb+ml96yYY9w8KKx8b1cTDJi6bovEKWdF0d+9Y=; b=ESDOfRg4wgXXueo9qc7+30Zhx6OZIz4j9XjFQMP89gMz1Ydvbo1+CAk9uEiUhcHWj2 kxwiQD8aJgVD9VTnfJN7eurCnuLLhihQOLToHeFzNEIXorYJha94ska0DrbJN+lxX6/N l4BW3i8ZBSchjhQBiVw8z6+pj5L4A6bdrKe3iB5KBAYsJLTQixT29y/RnJsNo3LJCgri ggGUQizlgCFH6OkrcUAaGnuEgEGgzQvKm3+D1M68gyfWd1AbrwWSWJRwJ0ZqWJ4lPeqS QNLX4FfwbI6VkEOzc1IK77kCZWn47PIvMwyVic+BmqHia7xVmjTJ1XpUovbKtrfHa3I8 jE1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JmbKkz1J; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w37-20020a631625000000b0044adcee18b2si9971640pgl.277.2022.10.09.09.13.22; Sun, 09 Oct 2022 09:13:38 -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=@gmail.com header.s=20210112 header.b=JmbKkz1J; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230156AbiJIPp5 (ORCPT + 99 others); Sun, 9 Oct 2022 11:45:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230017AbiJIPpy (ORCPT ); Sun, 9 Oct 2022 11:45:54 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D4592408B; Sun, 9 Oct 2022 08:45:53 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id v130-20020a1cac88000000b003bcde03bd44so7184335wme.5; Sun, 09 Oct 2022 08:45:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=7nRMSkb+ml96yYY9w8KKx8b1cTDJi6bovEKWdF0d+9Y=; b=JmbKkz1Jw/pgnvrZOmgP0Zo9MWwwLNmpJN3+e+pwC16qEybYFCiblKveHxpz26pSr+ Phc9sspbhuEayA2+LLZn8C4hvexpN7Qa2isk4KwF3GS4ED+F/vTTkLFvYy0FbTiSY91g H0rVInXMz1wyaxjwPhimc1mGKPgRGpHoogueQLf09MhLlFAz8G1MRzy3BhGcTGyqAlZS 5X3Efit43XbkAGKayC+SNPPmgLmgIy3eXe7yzWy/qX+3Fm3yN9P/ILlrP8oaE33v3m3y MVu0LPGV/qh9rN/sYl/aCmhPRx962Ca5esEOVTTPLc9IuBbO0g030lVviamMDXaIGqpU Vr8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7nRMSkb+ml96yYY9w8KKx8b1cTDJi6bovEKWdF0d+9Y=; b=oQ5QbJnpXLaBcLFOL+90cp90B0xxJ6L3+z+fTtyetRiDl/S1ND+wUzADEdfPEqOFu1 /iu4kNyJYkgKP7WqyX+pkcuIxA5bvtx7OwvqCbimcPQHXhXD369t2GzegZCRhfxceRx9 s+zcZoIz6TNXtT4HKpJWu6QJZ5Isp7kOWyL6zl+KOTDV44VYUY2cAVpZ5qauWBn4YJLS WIm0yWGi6dqPU1CR06Q/VE0kzXS+tEi/xvACW83V88oZs871I3OTNaJJQieQ2ZicBnMY YxdNfH9kt2euLkBS92zsC16KsbGh/crCz0qQD5kl2zIsfslHxAmsjyp4xCzs84JxROfT yb7w== X-Gm-Message-State: ACrzQf1usqlsqNH+gokWf5ssrPkWx5pDg2VQsFeqmsXeTshm7P0B1xnA 0buShlBunO4zTUTsUwZGwA== X-Received: by 2002:a05:600c:b47:b0:3b4:8604:410c with SMTP id k7-20020a05600c0b4700b003b48604410cmr9919564wmr.51.1665330351733; Sun, 09 Oct 2022 08:45:51 -0700 (PDT) Received: from localhost.localdomain ([46.53.253.37]) by smtp.gmail.com with ESMTPSA id q8-20020adffec8000000b0022afce9ea93sm6797658wrs.40.2022.10.09.08.45.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Oct 2022 08:45:51 -0700 (PDT) Date: Sun, 9 Oct 2022 18:45:49 +0300 From: Alexey Dobriyan To: Willy Tarreau Cc: lkp@intel.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, "Paul E. McKenney" Subject: Re: tools/nolibc: fix missing strlen() definition and infinite loop with gcc-12 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 Willy Tarreau wrote: > +#if defined(__GNUC__) && (__GNUC__ >= 12) > +__attribute__((optimize("no-tree-loop-distribute-patterns"))) > +#endif > static __attribute__((unused)) > -size_t nolibc_strlen(const char *str I'd suggest to use asm("") in the loop body. It worked in the past to prevent folding division loop back into division instruction. Or switch to size_t f(const char *s) { const char *s0 = s; while (*s++) ; return s - s0 - 1; } which compiles to 1 branch, not 2. But of course they could recognise this pattern too.