public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "matt at mattborland dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/109883] Stack Overflow in <cmath> functions with <stdfloat> types Date: Wed, 17 May 2023 12:29:22 +0000 [thread overview] Message-ID: <bug-109883-4-zqw3tKwUQU@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-109883-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109883 --- Comment #2 from Matt Borland <matt at mattborland dot com> --- (In reply to Xi Ruoyao from comment #1) > Cannot reproduce for me. Note that in this case GCC optimizes the entire > function call away (see https://godbolt.org/z/968bPTvh9) even with -O0 so I > can see no way how this will lead to a runtime error. Here is an updated reproducer: #include <iostream> #include <stdfloat> #include <cmath> int main() { auto val = std::pow(0.5F64, 2); std::cout << val << std::endl; } The failure can be seen godbolt here: https://godbolt.org/z/ej5nPn7o4. Running this same snippet locally with ASAN yields: AddressSanitizer:DEADLYSIGNAL ================================================================= ==110879==ERROR: AddressSanitizer: stack-overflow on address 0x7fff6e2e7ff8 (pc 0x00000040126e bp 0x7fff6e2e8010 sp 0x7fff6e2e8000 T0) #0 0x40126e in __gnu_cxx::__promote_2<decltype (((__gnu_cxx::__promote_2<_Float64, std::__is_integer<_Float64>::__value>::__type)(0))+((__gnu_cxx::__promote_2<_Float64, std::__is_integer<_Float64>::__value>::__type)(0))), std::__is_integer<decltype (((__gnu_cxx::__promote_2<_Float64, std::__is_integer<_Float64>::__value>::__type)(0))+((__gnu_cxx::__promote_2<_Float64, std::__is_integer<_Float64>::__value>::__type)(0)))>::__value>::__type std::pow<_Float64, _Float64>(_Float64, _Float64) (/home/mborland/Documents/boost/libs/math/test/so+0x40126e) (BuildId: 6f720390f8d2a24a6dabec3c85e9cf5bb4c192ea) SUMMARY: AddressSanitizer: stack-overflow (/home/mborland/Documents/boost/libs/math/test/so+0x40126e) (BuildId: 6f720390f8d2a24a6dabec3c85e9cf5bb4c192ea) in __gnu_cxx::__promote_2<decltype (((__gnu_cxx::__promote_2<_Float64, std::__is_integer<_Float64>::__value>::__type)(0))+((__gnu_cxx::__promote_2<_Float64, std::__is_integer<_Float64>::__value>::__type)(0))), std::__is_integer<decltype (((__gnu_cxx::__promote_2<_Float64, std::__is_integer<_Float64>::__value>::__type)(0))+((__gnu_cxx::__promote_2<_Float64, std::__is_integer<_Float64>::__value>::__type)(0)))>::__value>::__type std::pow<_Float64, _Float64>(_Float64, _Float64) ==110879==ABORTING For brevity I snipped out 245 more instances of the message next to #0. > And GCC for aarch64-darwin target (i. e. "macOS 13.3.1 on M1") is not a part > of this project, so are you using another fork? It is provided by homebrew as gcc@13. For this reply I am using my Fedora 38 system with "gcc version 13.1.1 20230511 (Red Hat 13.1.1-2) (GCC)"
next prev parent reply other threads:[~2023-05-17 12:29 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-17 6:39 [Bug c++/109883] New: " matt at mattborland dot com 2023-05-17 10:12 ` [Bug libstdc++/109883] " xry111 at gcc dot gnu.org 2023-05-17 10:12 ` xry111 at gcc dot gnu.org 2023-05-17 12:29 ` matt at mattborland dot com [this message] 2023-05-17 12:33 ` [Bug libstdc++/109883] Stack Overflow in <cmath> functions with <stdfloat> types and -std=c++23 xry111 at gcc dot gnu.org 2023-05-17 12:35 ` xry111 at gcc dot gnu.org 2023-05-17 12:40 ` xry111 at gcc dot gnu.org 2023-05-17 12:41 ` matt at mattborland dot com 2023-05-17 12:56 ` jakub at gcc dot gnu.org 2023-05-17 13:28 ` jakub at gcc dot gnu.org 2023-05-17 14:24 ` jakub at gcc dot gnu.org 2023-05-17 19:22 ` cvs-commit at gcc dot gnu.org 2023-05-17 19:27 ` cvs-commit at gcc dot gnu.org 2023-05-17 19:29 ` jakub at gcc dot gnu.org 2023-05-18 3:22 ` xry111 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-109883-4-zqw3tKwUQU@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: linkBe 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).