public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/61580] New: stoi function unknown on W7/Cygwin/x86_64
@ 2014-06-21 12:02 zosrothko at orange dot fr
  2014-12-22 16:06 ` [Bug libstdc++/61580] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: zosrothko at orange dot fr @ 2014-06-21 12:02 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 61580
           Summary: stoi function unknown on W7/Cygwin/x86_64
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zosrothko at orange dot fr

Hello

The following program
$ cat stoi.cpp
#include <string>

int main()
{
   std::string s = "123";
   int i = std::stoi(s);
}

does not compile on a W7/Cygwin/x86_64 platform. here the log
$ g++ -v stoi.cpp
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with:
/cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.3-2/src/gcc-4.8.3/configure
--srcdir=/cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.3-2/src/gcc-4.8.3
--prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
--libexecdir=/usr/libexec --datadir=/usr/share --localstatedir=/var
--sysconfdir=/etc --libdir=/usr/lib --datarootdir=/usr/share
--docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C
--build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin
--without-libiconv-prefix --without-libintl-prefix --enable-shared
--enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs
--enable-bootstrap --disable-__cxa_atexit --with-dwarf2 --with-tune=generic
--enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite
--enable-threads=posix --enable-libatomic --enable-libgomp --disable-libitm
--enable-libquadmath --enable-libquadmath-support --enable-libssp
--enable-libada --enable-libgcj-sublibs --disable-java-awt --disable-symvers
--with-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as
--with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix
--without-libintl-prefix --with-system-zlib --libexecdir=/usr/lib
Thread model: posix
gcc version 4.8.3 (GCC)
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/cc1plus.exe -quiet -v -Dunix -idirafter
/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../lib/../include/w32api
-idirafter ../../include/w32api stoi.cpp -quiet -dumpbase stoi.cpp
-mtune=generic -march=x86-64 -auxbase stoi -version -o /tmp/ccZYgiXq.s
GNU C++ (GCC) version 4.8.3 (x86_64-pc-cygwin)
        compiled by GNU C version 4.8.3, GMP version 6.0.0, MPFR version 3.1.2,
MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../x86_64-pc-cygwin/include"
ignoring nonexistent directory "../../include/w32api"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/include/c++
 /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/include/c++/x86_64-pc-cygwin
 /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/include/c++/backward
 /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/include
 /usr/local/include
 /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/include-fixed
 /usr/include
 /usr/lib/gcc/x86_64-pc-cygwin/4.8.3/../../../../lib/../include/w32api
End of search list.
GNU C++ (GCC) version 4.8.3 (x86_64-pc-cygwin)
        compiled by GNU C version 4.8.3, GMP version 6.0.0, MPFR version 3.1.2,
MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 636b2526cba54f47bd98b825d7c95d49
stoi.cpp: In function 'int main()':
stoi.cpp:6:12: error: 'stoi' is not a member of 'std'
    int i = std::stoi(s);
            ^


IMHO? the problem should come from the basic_string.h include where the
definition of stoi is guarded by
#if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \
     && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF))

and _GLIBCXX_USE_C99 is not defined 

FrancisANDRE@idefix /lib/gcc/x86_64-pc-cygwin/4.8.3/include/c++/bits
$ g++ -xc++ -std=gnu++11 -dM -E - < /dev/null | sort | grep _GLIB

FrancisANDRE@idefix /lib/gcc/x86_64-pc-cygwin/4.8.3/include/c++/bits
$ g++ -xc++ -std=c++11 -dM -E - < /dev/null | sort | grep _GLIB

Rgds


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libstdc++/61580] stoi function unknown on W7/Cygwin/x86_64
  2014-06-21 12:02 [Bug c++/61580] New: stoi function unknown on W7/Cygwin/x86_64 zosrothko at orange dot fr
@ 2014-12-22 16:06 ` redi at gcc dot gnu.org
  2015-04-21 22:29 ` redi at gcc dot gnu.org
  2015-04-22  0:17 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2014-12-22 16:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is similar to PR 58393, it's due to using a single _GLIBCXX_USE_C99 macro
instead of more fine-grained tests for specific features.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libstdc++/61580] stoi function unknown on W7/Cygwin/x86_64
  2014-06-21 12:02 [Bug c++/61580] New: stoi function unknown on W7/Cygwin/x86_64 zosrothko at orange dot fr
  2014-12-22 16:06 ` [Bug libstdc++/61580] " redi at gcc dot gnu.org
@ 2015-04-21 22:29 ` redi at gcc dot gnu.org
  2015-04-22  0:17 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2015-04-21 22:29 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-04-21
   Target Milestone|---                         |6.0
     Ever confirmed|0                           |1

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Splitting up the C99 tests to be more fine-grained is on my TODO list for 6.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug libstdc++/61580] stoi function unknown on W7/Cygwin/x86_64
  2014-06-21 12:02 [Bug c++/61580] New: stoi function unknown on W7/Cygwin/x86_64 zosrothko at orange dot fr
  2014-12-22 16:06 ` [Bug libstdc++/61580] " redi at gcc dot gnu.org
  2015-04-21 22:29 ` redi at gcc dot gnu.org
@ 2015-04-22  0:17 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2015-04-22  0:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The problem in this case is that newlib only defines C99 functions for C99 or
C++11, but the _GLIBCXX_USE_C99 tests in acinclude.m4 are compiled with
-std=gnu++98.

As discussed previously (on the mailing list IIRC) we need to test whether C99
functions are available in C++98 mode and test again whether they are available
in C++11 mode. For std::stoi() we don't care if they are missing in C++98 mode,
as long as they are present in C++11 mode (which is true for newlib).


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-04-22  0:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-21 12:02 [Bug c++/61580] New: stoi function unknown on W7/Cygwin/x86_64 zosrothko at orange dot fr
2014-12-22 16:06 ` [Bug libstdc++/61580] " redi at gcc dot gnu.org
2015-04-21 22:29 ` redi at gcc dot gnu.org
2015-04-22  0:17 ` redi at gcc dot gnu.org

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).