public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Baribault, Carl" <cbaribault@tulane.edu>
To: Jonathan Wakely <jwakely.gcc@gmail.com>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: gcc 9.5.0 compiler error: identifier "__builtin_is_constant_evaluated" is undefined
Date: Mon, 8 May 2023 21:33:45 +0000	[thread overview]
Message-ID: <SA1PR03MB65781841F68A642CE7FAAAE5B2719@SA1PR03MB6578.namprd03.prod.outlook.com> (raw)
In-Reply-To: <CAH6eHdSGEgxPCokHw-z2-7udtpyoc-L1vwSbrD07drANA7YyvQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4007 bytes --]

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.


$ 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++, and only occurs using Intel's icpc with GNU/g++ headers.


$ 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 <iostream>

#include <iomanip>

#include <cstdlib>


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 <jwakely.gcc@gmail.com>
Sent: Monday, May 8, 2023 3:05 PM
To: Baribault, Carl <cbaribault@tulane.edu>
Cc: gcc-help <gcc-help@gcc.gnu.org>
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<mailto: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

  parent reply	other threads:[~2023-05-08 21:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-08 18:59 Baribault, Carl
2023-05-08 20:05 ` Jonathan Wakely
2023-05-08 20:27   ` Jonathan Wakely
2023-05-08 21:33   ` Baribault, Carl [this message]
2023-05-08 22:55     ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SA1PR03MB65781841F68A642CE7FAAAE5B2719@SA1PR03MB6578.namprd03.prod.outlook.com \
    --to=cbaribault@tulane.edu \
    --cc=gcc-help@gcc.gnu.org \
    --cc=jwakely.gcc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).