public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "br015 at umbiko dot net" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/109921] New: c++17/floating_from_chars.cc: compile error: ‘from_chars_strtod’ was not declared in this scope Date: Sun, 21 May 2023 10:02:12 +0000 [thread overview] Message-ID: <bug-109921-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109921 Bug ID: 109921 Summary: c++17/floating_from_chars.cc: compile error: ‘from_chars_strtod’ was not declared in this scope Product: gcc Version: 13.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: br015 at umbiko dot net Target Milestone: --- This was observed in 13.1.0, but code is the same as git master. Line numbers and code snippets refer to git master. /observed error/ Cross-compiling gcc 13.1 for a system without locales, libstdc++ fails to build with the following error: >Making all in c++17 >/bin/bash ../../libtool --tag CXX --tag disable-shared --mode=compile /home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/build/./gcc/xgcc -shared-libgcc -B/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/build/./gcc -nostdinc++ -L/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/build/x86_64-buildroot-linux-uclibc/libstdc++-v3/src -L/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/build/x86_64-buildroot-linux-uclibc/libstdc++-v3/src/.libs -L/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/build/x86_64-buildroot-linux-uclibc/libstdc++-v3/libsupc++/.libs -B/home/data/buildroot.x86_64/host/x86_64-buildroot-linux-uclibc/bin/ -B/home/data/buildroot.x86_64/host/x86_64-buildroot-linux-uclibc/lib/ -isystem /home/data/buildroot.x86_64/host/x86_64-buildroot-linux-uclibc/include -isystem /home/data/buildroot.x86_64/host/x86_64-buildroot-linux-uclibc/sys-include -I/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/libstdc++-v3/../libgcc -I/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/build/x86_64-buildroot-linux-uclibc/libstdc++-v3/include/x86_64-buildroot-linux-uclibc -I/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/build/x86_64-buildroot-linux-uclibc/libstdc++-v3/include -I/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/libstdc++-v3/libsupc++ -std=gnu++17 -nostdinc++ -prefer-pic -D_GLIBCXX_SHARED -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2 -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -frandom-seed=floating_from_chars.lo -fimplicit-templates -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_GNU_SOURCE -fcf-protection -mshstk -c -o floating_from_chars.lo ../../../../../libstdc++-v3/src/c++17/floating_from_chars.cc >libtool: compile: /home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/build/./gcc/xgcc -shared-libgcc -B/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/build/./gcc -nostdinc++ -L/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/build/x86_64-buildroot-linux-uclibc/libstdc++-v3/src -L/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/build/x86_64-buildroot-linux-uclibc/libstdc++-v3/src/.libs -L/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/build/x86_64-buildroot-linux-uclibc/libstdc++-v3/libsupc++/.libs -B/home/data/buildroot.x86_64/host/x86_64-buildroot-linux-uclibc/bin/ -B/home/data/buildroot.x86_64/host/x86_64-buildroot-linux-uclibc/lib/ -isystem /home/data/buildroot.x86_64/host/x86_64-buildroot-linux-uclibc/include -isystem /home/data/buildroot.x86_64/host/x86_64-buildroot-linux-uclibc/sys-include -I/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/libstdc++-v3/../libgcc -I/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/build/x86_64-buildroot-linux-uclibc/libstlibtool: compile: /home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/build/./gcc/xgcc -shared-libgcc -B/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/build/./gcc -nostdinc++ -L/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/build/x86_64-buildroot-linux-uclibc/libstdc++-v3/src -L/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/build/x86_64-buildroot-linux-uclibc/libstdc++-v3/src/.libs -L/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/build/x86_64-buildroot-linux-uclibc/libstdc++-v3/libsupc++/.libs -B/home/data/buildroot.x86_64/host/x86_64-buildroot-linux-uclibc/bin/ -B/home/data/buildroot.x86_64/host/x86_64-buildroot-linux-uclibc/lib/ -isystem /home/data/buildroot.x86_64/host/x86_64-buildroot-linux-uclibc/include -isystem /home/data/buildroot.x86_64/host/x86_64-buildroot-linux-uclibc/sys-include -I/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/libstdc++-v3/../libgcc -I/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/build/x86_64-buildroot-linux-uclibc/libstdc++-v3/include/x86_64-buildroot-linux-uclibc -I/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/build/x86_64-buildroot-linux-uclibc/libstdc++-v3/include -I/home/data/buildroot.x86_64/build/host-gcc-final-13.1.0/libstdc++-v3/libsupc++ -std=gnu++17 -nostdinc++ -D_GLIBCXX_SHARED -fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2 -fdiagnostics-show-location=once -ffunction-sections -fdata-sections -frandom-seed=floating_from_chars.lo -fimplicit-templates -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_GNU_SOURCE -fcf-protection -mshstk -c ../../../../../libstdc++-v3/src/c++17/floating_from_chars.cc -fPIC -DPIC -D_GLIBCXX_SHARED -o floating_from_chars.o >../../../../../libstdc++-v3/src/c++17/floating_from_chars.cc: In function ‘std::from_chars_result std::from_chars(const char*, const char*, _Float128&, chars_format)’: >../../../../../libstdc++-v3/src/c++17/floating_from_chars.cc:1281:10: error: ‘from_chars_strtod’ was not declared in this scope > 1281 | return from_chars_strtod(first, last, value, fmt); > | ^~~~~~~~~~~~~~~~~ >make[7]: *** [Makefile:587: floating_from_chars.lo] Error 1 /root cause analysis/ The symbol USE_STRTOD_FOR_FROM_CHARS is initially unknown. Since the target system does not use locales, it will not be defined within the scope of floating_to_chars.cc [1]: >#if _GLIBCXX_HAVE_USELOCALE >// FIXME: This should be reimplemented so it doesn't use strtod and newlocale. >// That will avoid the need for any memory allocation, meaning that the >// non-conforming errc::not_enough_memory result cannot happen. ># define USE_STRTOD_FOR_FROM_CHARS 1 >#endif This results in code for from_chars_strtod() not being generated (lines 366 to 794) [2]. from_chars() implementation is generated either if USE_LIB_FAST_FLOAT or USE_STRTOD_FOR_FROM_CHARS is enabled [3]. Within this section is code that relies on USE_STRTOD_FOR_FROM_CHARS, but omits to check if the functionality is available [4] >#elif defined(USE_STRTOF128_FOR_FROM_CHARS) >from_chars_result >from_chars(const char* first, const char* last, _Float128& value, > chars_format fmt) noexcept >{ > // fast_float doesn't support IEEE binary128 format, but we can use strtold. > return from_chars_strtod(first, last, value, fmt); >} >#endif which results in the observed compilation error. /proposed change/ Check if USE_STRTOD_FOR_FROM_CHARS is set before using from_chars_strtod(): --- a/libstdc++-v3/src/c++17/floating_from_chars.cc 2023-04-26 09:09:43.000000000 +0200 +++ b/libstdc++-v3/src/c++17/floating_from_chars.cc 2023-05-19 07:56:56.754330183 +0200 @@ -1264,6 +1264,8 @@ __attribute__((alias ("_ZSt10from_charsPKcS0_RdSt12chars_format"))); #endif +#if defined(USE_STRTOD_FOR_FROM_CHARS) +// otherwise there is no from_chars_strtod #ifdef _GLIBCXX_LONG_DOUBLE_ALT128_COMPAT from_chars_result from_chars(const char* first, const char* last, __ieee128& value, @@ -1282,6 +1284,8 @@ } #endif +#endif // USE_STRTOD_FOR_FROM_CHARS + #endif // USE_LIB_FAST_FLOAT || USE_STRTOD_FOR_FROM_CHARS _GLIBCXX_END_NAMESPACE_VERSION [1] https://github.com/gcc-mirror/gcc/blob/7f3df8e65c71e5df01fe7fe7de577bb9ff48f37b/libstdc%2B%2B-v3/src/c%2B%2B17/floating_from_chars.cc#L53-L58 [2] https://github.com/gcc-mirror/gcc/blob/7f3df8e65c71e5df01fe7fe7de577bb9ff48f37b/libstdc%2B%2B-v3/src/c%2B%2B17/floating_from_chars.cc#L366-L794 [3] https://github.com/gcc-mirror/gcc/blob/7f3df8e65c71e5df01fe7fe7de577bb9ff48f37b/libstdc%2B%2B-v3/src/c%2B%2B17/floating_from_chars.cc#L1230-L1342 [4] https://github.com/gcc-mirror/gcc/blob/7f3df8e65c71e5df01fe7fe7de577bb9ff48f37b/libstdc%2B%2B-v3/src/c%2B%2B17/floating_from_chars.cc#L1317-L1340
next reply other threads:[~2023-05-21 10:02 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-21 10:02 br015 at umbiko dot net [this message] 2023-05-24 11:16 ` [Bug libstdc++/109921] " redi at gcc dot gnu.org 2023-05-24 13:01 ` redi at gcc dot gnu.org 2023-05-25 8:31 ` br015 at umbiko dot net 2023-05-31 12:21 ` cvs-commit at gcc dot gnu.org 2023-05-31 12:24 ` redi at gcc dot gnu.org 2023-05-31 19:57 ` cvs-commit at gcc dot gnu.org 2023-07-19 19:53 ` redi at gcc dot gnu.org 2023-07-19 22:43 ` [Bug libstdc++/109921] [13 Regression] " cvs-commit at gcc dot gnu.org 2023-07-19 23:31 ` cvs-commit at gcc dot gnu.org 2023-07-19 23:33 ` redi at gcc dot gnu.org 2023-07-20 11:57 ` redi at gcc dot gnu.org 2023-07-21 13:04 ` redi at gcc dot gnu.org 2023-07-22 6:05 ` br015 at umbiko dot net 2023-07-22 9:01 ` 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-109921-4@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).