From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by sourceware.org (Postfix) with ESMTPS id 079953857703 for ; Wed, 24 May 2023 09:26:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 079953857703 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-50bcb229adaso1510935a12.2 for ; Wed, 24 May 2023 02:26:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684920408; x=1687512408; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=eIGd9/qGxL6SUHoP3HRhfxqnw9ewcNvOoDxJkL6DUEA=; b=Na/8/9JMlOffTkH4kymrL7sc473KIdM27L5xeX0GTojhkpkJ/ufTjkwxEG6eMSAxv/ AuuK7EiDXohsx4/BLtURjC92ajvgm25pFAwoipXrPTSEIaPD3NlMisoZsO6BUdVtxPWP H4qtWiVz6o8S5bcX04KRGmrlbjsf+4zfI6/mKDVA39OkFDTVPX75y4lgFZdWLIbdgX8t jTktMdoL7u7gtK9KUx63f14yV0R1NKubyM+2PHOfzx8dWDZZ8LSdBLjBqrnH+3g70wJS PuCNltif9VdY31wkRkklFeupn9MjJyf3uF9/v4fNmDy4YTnb5Nzn3jSQIMn2vVVwg715 cWOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684920408; x=1687512408; 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=eIGd9/qGxL6SUHoP3HRhfxqnw9ewcNvOoDxJkL6DUEA=; b=WEvdhkIQtXb2W/lhJOjDE/4nS5SVusZERk5ZgKH9ITbtR0f3YOTexRP2bPRBkmLY+C C/BNaSQMFMQiTzz020kF77ehDDJCqTqbx+V8TSBZB39GKy/Oxb765pVS1RFq+HBP108i 1l9kBlmKZAEPyvBZMg0G9w4taWRD8SOk+2fAmqjWe0RJnERPZiCxSZvmc30Rltu/tkmn yvuUgIufD+4AuFsGx7h81K3GGAbIis2I7UylsmXD+u+UABNWI350RpKjDn8/kQMgjtnj deWJu3uRhyoiZy3kM+Hx/HLP88jhB7728udiqdXD546mDinLvM4lIVCy1XAR6nmxpwfK 0d3A== X-Gm-Message-State: AC+VfDy+kn32Lzthl7aGh3UmUd0DK1+hVLhVnYqZbYYhZ5upL8cqwK9L AsWXGmwGPHLvnRWIeAcaslqKQDcFKtZOhTqN/uI= X-Google-Smtp-Source: ACHHUZ5vKHxxe3ybwavl8jmyuchgclqRMEBWBih9moNBTW3JkpJhSxEmpXSn7fzjOrSXNhMQUv0jrtGlA2tjAVszxaY= X-Received: by 2002:a17:907:7204:b0:972:aa30:203e with SMTP id dr4-20020a170907720400b00972aa30203emr3936883ejc.34.1684920408255; Wed, 24 May 2023 02:26:48 -0700 (PDT) MIME-Version: 1.0 References: <2e8a8750bb4b44a535a9df669183f6fa@disroot.org> <87sfbmxfnf.fsf@oldenburg.str.redhat.com> In-Reply-To: <87sfbmxfnf.fsf@oldenburg.str.redhat.com> From: Jonathan Wakely Date: Wed, 24 May 2023 10:26:37 +0100 Message-ID: Subject: Re: Differences between clang and gcc handling of int[static n] function arguments To: Florian Weimer Cc: Jonathan Wakely via Gcc , peter0x44 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.7 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,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, 24 May 2023 at 10:06, Florian Weimer wrote: > > * Jonathan Wakely via Gcc: > > >> It seems it might even be trivial enough for me to investigate and > >> tackle myself, in some spare time. > >> > >> I see very little code using either of these features, so it's > >> definitely not a high priority task regardless. > >> > > > > Glibc uses the nonnull attribute in many places. Libstdc++ uses it in a few > > places. > > Note that the glibc uses are frequently incompatible with libstdc++ Do you mean incompatible with libstdc++ specifically, or incompatible with "common C++ idioms"? > (std::vector in particular). Unfortunately, there is no consensus to > fix this. For example, one issue is that > > memset(vec.data(), 0, sizeof(decltype(vec)::value_type) * vec.size()) > > isn't necessarily defined even for vectors of POD type. It's not really idiomatic C++ code anyway. Why would you write that, instead of: vec.assign(vec.size(), {}); or: std::fill_n(vec.begin(), vec.size(), range_value_t:{}); ? (The latter optimizes to the ideal code, but I think I know how to make the former optimize to the same thing.)