public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/51146] The name clog for a global variable triggers a segfault inside std::pow
Date: Thu, 30 Sep 2021 10:02:55 +0000	[thread overview]
Message-ID: <bug-51146-4-Hbub0wm7I7@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-51146-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51146

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Libc++ uses complex<_Tp>(log(abs(__x)), arg(__x));

Even for C++11, which is based on C99, ::clog is not a reserved name in C++
because C++ specifies that <complex.h> just includes the C++ <complex> header,
so defines std::complex and none of the C99 complex routines exist in C++. This
is not a universally popular feature of C++. But it does mean that a strictly
conforming C++ program can use ::clog for whatever purpose it wants.

However, in practice, our implementation doesn't exist in a vacuum and depends
on an underlying system library (which is usually based on POSIX) and so those
symbols are essentially reserved too, even if the C++ standard doesn't say so.

E.g. if you define a symbol called ::fdopen or ::open you're asking for
trouble, even though those are not in ISO C++.

If you want a pure ISO C++ environment that doesn't rely on additional features
of POSIX and C99, maybe you need to look elsewhere.

  parent reply	other threads:[~2021-09-30 10:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-15 19:53 [Bug c++/51146] New: " alpha_lc at hotmail dot com
2011-11-15 20:09 ` [Bug libstdc++/51146] " pinskia at gcc dot gnu.org
2011-11-15 20:13 ` alpha_lc at hotmail dot com
2011-11-15 20:21 ` [Bug c++/51146] " paolo.carlini at oracle dot com
2011-11-15 20:33 ` paolo.carlini at oracle dot com
2011-11-15 20:33 ` pinskia at gcc dot gnu.org
2011-11-15 22:44 ` joseph at codesourcery dot com
2011-11-15 23:11 ` paolo.carlini at oracle dot com
2011-11-15 23:29 ` redi at gcc dot gnu.org
2011-11-16  0:13 ` paolo.carlini at oracle dot com
2021-09-30  9:14 ` pinskia at gcc dot gnu.org
2021-09-30 10:02 ` redi at gcc dot gnu.org [this message]
2021-09-30 10:04 ` redi at gcc dot gnu.org

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=bug-51146-4-Hbub0wm7I7@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).