From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id 16FC73858D35 for ; Mon, 8 May 2023 22:55:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 16FC73858D35 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-ej1-x635.google.com with SMTP id a640c23a62f3a-965cc5170bdso714241066b.2 for ; Mon, 08 May 2023 15:55:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683586551; x=1686178551; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=pAR9wX3kUwdZsfHyglveo1N/ydOL4D0T0LNX3nfAixE=; b=DMTU1sWuY10ZEXqT5TVbLB/eyvixhZyloCeXiLiQbg+/teRV0YG7z9wtDmztlNqs0r 9IOVw/5ZcMReHJ8j5xdvPXasZqVohOvlEcewD64bkjzbn95pV+fY8oOSAxS5lTUz4yK+ rIWcUXzeoOcJ+2Mg6vTyRPbTDpKKSWFfOlrm8EabRmFcutT44k0Vg9Wku5HGPhDJ0Xn1 b0ugCXIHy3Id7EF0MNyB/MTjnVL7/74u9IC43uzFWFC7oQ/xD4FZMG7gQvJGnFGfR5HI npzStKLlUuMKXTgaE0yvzNzMproLmsV0LRw46UStTWn74893ZDssIwRyrca3iGjTuPaJ wGzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683586551; x=1686178551; 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=pAR9wX3kUwdZsfHyglveo1N/ydOL4D0T0LNX3nfAixE=; b=J6b5BlhqV5iBEXHWtD+kUoOchxrIgPMAN5NXNEMsNL+C/utKpj9zFSk0OfR2jeWA6+ vH8+3ANOGkJHkXGJKpa4hgrBYszfEz2445zMhOO9uFz/BJj39qezCQwWDGBA80MsRKF3 qfomO2lNXoYxnORSOxkGaECDGZNQEuBYjXunqHaobIrnl+ZaLV+jmTIneEJPLJGjAawh UCVJFxgCm6FpXMhluL4l7Zi0DmKRQYWBvFTyicjDNPppiXuth7KLYmcyc7F9ICt0uwdj QegpZfV1Jzpq/VfJMSv46muvnlpDWIXE2zYXrxWzPQGiw6Jf/PffLacBMPvUGHPzCgEl U7Ag== X-Gm-Message-State: AC+VfDyQu+fT3HoJ6sVChfIeMPoVX2BBZIFiOmg9SFORoIhT6J8HYj3N /f4uj2bQLvO11FY6Gyg8V7EmO7rQaR6kGGrAXoU= X-Google-Smtp-Source: ACHHUZ5JJERr/6tk+Kg6ncK6gLhdMIO7aQPs2i9W2MRf5uh8dSTdtvdca3wrh6jl2298mywhVWVP3o7/2202UvaJWiQ= X-Received: by 2002:a17:907:6287:b0:962:582d:89d7 with SMTP id nd7-20020a170907628700b00962582d89d7mr11713340ejc.38.1683586550619; Mon, 08 May 2023 15:55:50 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Mon, 8 May 2023 23:55:37 +0100 Message-ID: Subject: Re: gcc 9.5.0 compiler error: identifier "__builtin_is_constant_evaluated" is undefined To: "Baribault, Carl" Cc: gcc-help Content-Type: multipart/alternative; boundary="0000000000004c614205fb368aa5" X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,NUMERIC_HTTP_ADDR,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: --0000000000004c614205fb368aa5 Content-Type: text/plain; charset="UTF-8" On Mon, 8 May 2023, 22:33 Baribault, Carl, wrote: > Hi Jonathan, > > Thanks for your reply. > > I've installed gcc 9.5.0 on our campus cluster under > /share/apps/centos7/gcc/9.5.0. > > When I search for that function name among the installed files, I see it > used multiple times, but I don't see that function defined anywhere. > Please advise, thanks. > It's a compiler built-in. The clue is in the name. It's defined by the compiler. > $ grep -r __builtin_is_constant_evaluated /share/apps/centos7/gcc/9.5.0 > > /share/apps/centos7/gcc/9.5.0/include/c++/9.5.0/bit: if (! > *__builtin_is_constant_evaluated*()) > > > /share/apps/centos7/gcc/9.5.0/include/c++/9.5.0/x86_64-pc-linux-gnu/bits/c++config.h > :# if __has_builtin(*__builtin_is_constant_evaluated*) > > /share/apps/centos7/gcc/9.5.0/include/c++/9.5.0/type_traits: { return > *__builtin_is_constant_evaluated*(); } > > /share/apps/centos7/gcc/9.5.0/include/c++/9.5.0/bits/stl_function.h: if ( > *__builtin_is_constant_evaluated*()) > > /share/apps/centos7/gcc/9.5.0/include/c++/9.5.0/bits/stl_function.h: if ( > *__builtin_is_constant_evaluated*()) > > /share/apps/centos7/gcc/9.5.0/include/c++/9.5.0/bits/stl_function.h: if ( > *__builtin_is_constant_evaluated*()) > > /share/apps/centos7/gcc/9.5.0/include/c++/9.5.0/bits/stl_function.h: if ( > *__builtin_is_constant_evaluated*()) > > /share/apps/centos7/gcc/9.5.0/include/c++/9.5.0/bits/char_traits.h: return > *__builtin_is_constant_evaluated*(); > > /share/apps/centos7/gcc/9.5.0/include/c++/9.5.0/bits/char_traits.h: return > *__builtin_is_constant_evaluated*(); > > Binary file > /share/apps/centos7/gcc/9.5.0/libexec/gcc/x86_64-pc-linux-gnu/9.5.0/cc1plus > matches > > Also, here's the error message. > > In file included from > /share/apps/centos7/gcc/9.5.0/include/c++/9.5.0/bits/ios_base.h(46), > > from > /share/apps/centos7/gcc/9.5.0/include/c++/9.5.0/ios(42), > > from > /share/apps/centos7/gcc/9.5.0/include/c++/9.5.0/ostream(38), > > from > /share/apps/centos7/gcc/9.5.0/include/c++/9.5.0/iostream(39), > > from pic.cpp(6): > > /share/apps/centos7/gcc/9.5.0/include/c++/9.5.0/bits/stl_function.h(437): > error: identifier "__builtin_is_constant_evaluated" is undefined > > if (__builtin_is_constant_evaluated()) > > ^ > > > compilation aborted for pic.cpp (code 2) > > Also, granted this error does not occur compiling pic.cpp using g++, > Right, so when you said "gcc 9.5.0: compiler error" in the email Subject, you meant something different. Because it is defined by gcc, and you don't get an error with gcc. and only occurs using Intel's icpc with GNU/g++ headers. > That was essential information that was completely missing from your first email. The problem is that Intel's compiler defines the __GNUC__ macro to the same value as the system gcc, which means that it's identifying itself as gcc 9, and so libstdc++ headers assume it supports all the same built-ins as gcc 9. The built-in was added to gcc more than 4 years ago, and will have been supported by Intel's compiler soon after. Have you tried updating your Intel compiler? If I understand correctly, old versions of the Intel compiler are unsupported, you should always be using an up to date version. > $ cat pic.cpp > > // C++ program to estimate value of pi > > // See discussion for Improved Say of Determining Pi at > > // http://mb-soft.com/public3/pi.html (retrieved March 2017) > > // If we integrate 1/(1+x^2) for x=0:1, we get pi/4 > > > #include > > #include > > #include > > > using std::cout; > > > int main(int argc, char* argv[]) > > { > > long i, nsteps; > > double pi, step, sum = 0.0; > > nsteps = 0; > > if (argc > 1) > > nsteps = atol(argv[1]); > > if (nsteps <= 0) > > nsteps = 100; > > step = (1.0)/((double)nsteps); > > for (i = 0; i < nsteps; ++i) { > > double x = ((double)i+0.5)*step; > > sum += 1.0 / (1.0 + x * x); > > } > > pi = 4.0 * step * sum; > > cout << std::fixed; > > cout << "pi is " << std::setprecision(17) << pi << "\n"; > > } > > ------------------------------ > *From:* Jonathan Wakely > *Sent:* Monday, May 8, 2023 3:05 PM > *To:* Baribault, Carl > *Cc:* gcc-help > *Subject:* Re: gcc 9.5.0 compiler error: identifier > "__builtin_is_constant_evaluated" is undefined > > > External Sender. Be aware of links, attachments and requests. > > > On Mon, 8 May 2023, 20:00 Baribault, Carl via Gcc-help, < > gcc-help@gcc.gnu.org> wrote: > > Dear Help, > > The subject identifier is nowhere defined. > > Please let me know if you need any more information. Thank you. > > > Yes, we need more info, you've provided none at all. > > That is a built-in function provided by the compiler, present since gcc > 9.1.0 > > In what context are you seeing it not defined? What are you trying to do, > and what error do you get? > > > > > > > Best, > C. Baribault > > --0000000000004c614205fb368aa5--