From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x2a.google.com (mail-oa1-x2a.google.com [IPv6:2001:4860:4864:20::2a]) by sourceware.org (Postfix) with ESMTPS id D73553858C01 for ; Wed, 4 Oct 2023 16:47:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D73553858C01 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=google.com Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-1dd2e65ed59so1408326fac.1 for ; Wed, 04 Oct 2023 09:47:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696438066; x=1697042866; darn=gcc.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=SmMZ22sxji9chn48EYSdHCdvviK1DzLAJQJd0YUR2Jk=; b=GxWDUHE5u+eVlbAivetcnkte8Pz6z/IVyFQE7lf7YnO3rYL/SOfQyFF/sJd0C2Yl0I P50NFhJWOG5g8HwLDnFIeoihqqLBl5yeedG4x2L4imBOWUkVuj+CeNqE1Nh3I/an64EO AzrOC0QemSNrghE4GNJ0kS2FQwGAWXJx/Ot/rSTaaeXtNgpf/nA8YHeRgjayqF/dSTHg JTuYRbDSjI9PCA+8w5R7UA3dWv2WqTHqpeKeknzRjq+hKPG1sDLN9YCV07ux3mISCH8a fct89XsWotW7owfuUVQ62UHUzkaTa2aPbbUX0lsB0IAz83/p2iSYlpKqTilZ6AAWIcW1 1h2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696438066; x=1697042866; 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=SmMZ22sxji9chn48EYSdHCdvviK1DzLAJQJd0YUR2Jk=; b=ATLGcjkk6YTwEcIUZPuq7r1VYUyP9XftSqA4/3rvMeSqkY59Nw8gdQ3WkcMbvS9D3i hCEjGnn8OyDFRyRA4fh4XN7fJ7CpMNIHBZUMRo/urLumFd9rF38gJ83CI7aGtzNeG3QL t2TAlpLT65YT2cjrlVFeckqbPKToZMtZwH4rOUIps+u4DA9wtuYazf3fQ8gV1VtNYGQq tZuOcwTkrwVc0lsIjKgyLeN1lJXSuJfcVq1KvW73qIapxn05wjm6ymKsym1pW4Yfnt9A frGjHWVSKcs8r7YYUOGqumz7sN29IAXlBphkDZOhV2Az9nPlDsHCaonfbvtjkkEgT4dy VJ0Q== X-Gm-Message-State: AOJu0YycmGBri1JTfmpkj4Gb23mYAjcjmS9vBZKYgRtiIZYxtapMjOLe DS8+XKKY/nmTo5kP3ys4AMsej+RdxtMlot36VU6Q3A== X-Google-Smtp-Source: AGHT+IF1Gy1JWYuOSZhjrIwswEsMtyF07/GHG8QKaThx1tQoxk4LOhAxU+OPnEoQTXH8NguYH70JPD8H7tFVc+Gx7bc= X-Received: by 2002:a05:6870:461b:b0:1d5:aed5:6579 with SMTP id z27-20020a056870461b00b001d5aed56579mr3146014oao.4.1696438065665; Wed, 04 Oct 2023 09:47:45 -0700 (PDT) MIME-Version: 1.0 References: <20230817203213.1131496-1-jwakely@redhat.com> <097e48f1-b915-4d6c-b68e-8ee282bc6de5@redhat.com> In-Reply-To: From: Pranav Kant Date: Wed, 4 Oct 2023 09:47:34 -0700 Message-ID: Subject: Re: [committed] libstdc++: Define std::numeric_limits<_FloatNN> before C++23 To: Jonathan Wakely Cc: Stephan Bergmann , libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Content-Type: multipart/alternative; boundary="0000000000004a5d8a0606e6c4c2" X-Spam-Status: No, score=-27.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,ENV_AND_HDR_SPF_MATCH,GIT_PATCH_0,HTML_MESSAGE,KAM_NUMSUBJECT,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --0000000000004a5d8a0606e6c4c2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks for bringing this to my attention. I am working on a fix. Will keep this thread posted. Clang *does* define this macro only when float128 type is available. But the problem seems to be that clang doesn't define _Float128 alias type which is what's being used here. It only defines __float128 type. Should be easy to fix. On Wed, Oct 4, 2023 at 8:56=E2=80=AFAM Jonathan Wakely = wrote: > On Wed, 4 Oct 2023 at 16:54, Stephan Bergmann wrote: > > > > On 8/17/23 22:32, Jonathan Wakely via Libstdc++ wrote: > > > Tested x86_64-linux. Pushed to trunk. > > > > > > -- >8 -- > > > > > > The extended floating-point types such as _Float32 are supported by G= CC > > > prior to C++23, you just can't use the standard-conforming names from > > > to refer to them. This change defines the specializations = of > > > std::numeric_limits for those types for older dialects, not only for > > > C++23. > > > > > > libstdc++-v3/ChangeLog: > > > > > > * include/bits/c++config (__gnu_cxx::__bfloat16_t): Define > > > whenever __BFLT16_DIG__ is defined, not only for C++23. > > > * include/std/limits (numeric_limits): Likewise. > > > (numeric_limits<_Float16>, numeric_limits<_Float32>) > > > (numeric_limits<_Float64>): Likewise for other extended > > > floating-point types. > > > --- > > > libstdc++-v3/include/bits/c++config | 4 +- > > > libstdc++-v3/include/std/limits | 194 > +++++++++++++++------------- > > > 2 files changed, 103 insertions(+), 95 deletions(-) > > > > > [...] > > > diff --git a/libstdc++-v3/include/std/limits > b/libstdc++-v3/include/std/limits > > > index 52b19ef8264..7a59e7520eb 100644 > > > --- a/libstdc++-v3/include/std/limits > > > +++ b/libstdc++-v3/include/std/limits > > > @@ -1890,189 +1890,197 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > > [...] > > > __glibcxx_float_n(64) > > > #endif > > > -#ifdef __STDCPP_FLOAT128_T__ > > > +#ifdef __FLT128_DIG__ > > > __glibcxx_float_n(128) > > > #endif > > > #undef __glibcxx_float_n > > [...] > > > > The above change (from __STDCPP_FLOAT128_T__ to __FLT128_DIG__) now > > started to cause issues with Clang on Clang 18 trunk: > > > > * Clang does not support a _Float128 type. > > > > * Clang does not predefine __STDCPP_FLOAT128_T__. > > > > * But since > > < > https://github.com/llvm/llvm-project/commit/457f582ffe23e951380bc345c4c96= ec053c09681 > > > > "[clang] Predefined macros for float128 support (#67196)", Clang 18 > > trunk does predefine __FLT128_DIG__ now. Which causes > > > > > $ cat test.cc > > > #include > > > > > $ clang++ -fsyntax-only test.cc > > > In file included from test.cc:1: > > > > /home/sbergman/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../..= /../include/c++/14.0.0/limits:1995:1: > error: use of undeclared identifier '_Float128' > > > 1995 | __glibcxx_float_n(128) > > > | ^ > > > > /home/sbergman/gcc/trunk/inst/lib/gcc/x86_64-pc-linux-gnu/14.0.0/../../..= /../include/c++/14.0.0/limits:1903:27: > note: expanded from macro '__glibcxx_float_n' > > > 1903 | struct numeric_limits<_Float##BITSIZE> > \ > > > | ^ > > > :36:1: note: expanded from here > > > 36 | _Float128 > > > | ^ > > > 1 error generated. > > > > (I don't know whether or not it is useful for Clang to predefine > > __FLT128_DIG__ when not providing a _Float128 type. I assume > > "ISO/IEC TS 18661-3:2015", as > > referenced by the C++ standard, might be relevant here, but don't know > > that document. I added Pranav, the author of the relevant Clang commit, > > in cc here.) > > > It's completely wrong or Clang to define a macro describing properties > of a non-existent type. > > This was reported as > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111687 and closed as > INVALID, it needs to be fixed in Clang. > > > > > > --0000000000004a5d8a0606e6c4c2--