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 libstdc++/109818] std::trunc() requires a <cmath> hack after building DJGPP
Date: Fri, 12 May 2023 08:07:44 +0000	[thread overview]
Message-ID: <bug-109818-4-w0heyh3ABG@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109818-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Janez Zemva from comment #8)
> I took a look and I believe the c_global is already being selected and I
> believe the hack I presented should perhaps be applied to
> libstdc++-v3/include/c_global/cmath 

No, absolutely not, std::trunc is already defined in that file, see line 2023:

  using ::trunc;
  using ::truncf;
  using ::truncl;

And then at line 2642:

#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
  constexpr float
  trunc(float __x)
  { return __builtin_truncf(__x); }

  constexpr long double
  trunc(long double __x)
  { return __builtin_truncl(__x); }
#endif

#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT
  template<typename _Tp>
    constexpr typename __gnu_cxx::__enable_if<__is_integer<_Tp>::__value, 
                                              double>::__type
    trunc(_Tp __x)
    { return __builtin_trunc(__x); }
#endif


(In reply to Janez Zemva from comment #9)
> I'd also like to mention, that the hack is already present in the c_global
> cmath file, but is perhaps in a wrong section of the file, i.e. it is in the
> section protected by:
> 
> #if defined(__STDCPP_FLOAT64_T__) &&
> defined(_GLIBCXX_DOUBLE_IS_IEEE_BINARY64)
> 
> while I can see _GLIBCXX_DOUBLE_IS_IEEE_BINARY64 is defined in c++config.h,
> I don't see __STDCPP_FLOAT64_T__ defined anywhere.

No, you're looking at the definition for trunc(_Float64) which is a completely
different overload.

  parent reply	other threads:[~2023-05-12  8:07 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-11 18:42 [Bug libstdc++/109818] New: " janezz55 at gmail dot com
2023-05-11 20:11 ` [Bug libstdc++/109818] " redi at gcc dot gnu.org
2023-05-11 20:13 ` redi at gcc dot gnu.org
2023-05-11 20:56 ` janezz55 at gmail dot com
2023-05-11 21:13 ` redi at gcc dot gnu.org
2023-05-11 21:14 ` redi at gcc dot gnu.org
2023-05-11 21:27 ` janezz55 at gmail dot com
2023-05-11 22:17 ` redi at gcc dot gnu.org
2023-05-12  5:21 ` janezz55 at gmail dot com
2023-05-12  6:05 ` janezz55 at gmail dot com
2023-05-12  8:07 ` redi at gcc dot gnu.org [this message]
2023-05-12  8:15 ` redi at gcc dot gnu.org
2023-05-12 10:14 ` janezz55 at gmail dot com
2023-05-12 10:16 ` redi at gcc dot gnu.org
2023-05-12 10:23 ` janezz55 at gmail dot com
2023-05-12 10:48 ` redi at gcc dot gnu.org
2023-05-12 10:55 ` redi at gcc dot gnu.org
2023-05-12 16:35 ` janezz55 at gmail dot com
2023-05-12 16:45 ` redi at gcc dot gnu.org
2023-05-12 21:21 ` redi at gcc dot gnu.org
2023-05-12 21:58 ` redi at gcc dot gnu.org
2023-05-12 22:01 ` redi at gcc dot gnu.org
2023-05-12 23:17 ` janezz55 at gmail dot com
2023-05-12 23:43 ` redi at gcc dot gnu.org
2023-05-13  1:19 ` janezz55 at gmail dot com
2023-05-13  9:55 ` redi at gcc dot gnu.org
2023-05-13 13:01 ` janezz55 at gmail dot com
2023-05-14 12:26 ` janezz55 at gmail dot com
2023-05-14 19:56 ` redi at gcc dot gnu.org
2023-05-14 20:02 ` redi at gcc dot gnu.org
2023-05-31 20:20 ` cvs-commit at gcc dot gnu.org
2023-05-31 20:24 ` redi at gcc dot gnu.org
2023-05-31 23:03 ` janezz55 at gmail dot com
2023-06-01 10:41 ` 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-109818-4-w0heyh3ABG@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).