This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Severe wchar_t limit problems


Until some days ago the types long and wchar_t had the same limits on the
i686-pc-linux-gnu target. Now they differ and the max value is lower than
the min value for wchar_t type as shown by the appended source code tpw.C
if compiled by gcc 3.1 20011024.

Hope this helps,

Peter Schmid

tpw.C
#include <iostream>
#include <limits>
#include <limits.h>

int main()
{
    
    std::cout << "limit.h" << std::endl;
    std::cout << "Checking " << "long"
              << "; min is " << LONG_MIN
              << ", max is " << LONG_MAX
              << std::endl;

    std::cout << "limit" <<std::endl;
    std::cout << "Checking " << "wchar_t"
              << "; min is " << std::numeric_limits<wchar_t>::min()
              << ", max is " << std::numeric_limits<wchar_t>::max()
              << std::endl;
}

Compiling tpw.C

g++ -v -o tpw tpw.C -W -Wall
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs
Configured with: ../gcc/configure --enable-shared --enable-threads=posix --enable-languages=c,c++,f77,objc --disable-nls --enable-clocale=gnu
Thread model: posix
gcc version 3.1 20011024 (experimental)
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=1 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -W -Wall -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ tpw.C -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpbase tpw.C -W -Wall -version -o /tmp/cczU8nHc.s
GNU CPP version 3.1 20011024 (experimental) (cpplib) (i386 Linux/ELF)
GNU C++ version 3.1 20011024 (experimental) (i686-pc-linux-gnu)
	compiled by GNU C version 3.1 20011024 (experimental).
ignoring nonexistent directory "NONE/include"
ignoring nonexistent directory "/usr/local/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include/g++-v3
 /usr/local/include/g++-v3/i686-pc-linux-gnu
 /usr/local/include/g++-v3/backward
 /usr/local/include
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/../../../../i686-pc-linux-gnu/bin/as -V -Qy -o /tmp/ccROuvLn.o /tmp/cczU8nHc.s
GNU assembler version 2.11.90.0.23 (i686-pc-linux-gnu) using BFD version 2.11.90.0.23
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/collect2 -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o tpw /usr/lib/crt1.o /usr/lib/crti.o /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/crtbegin.o -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1 -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/../../../../i686-pc-linux-gnu/lib -L/usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/../../.. /tmp/ccROuvLn.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.1/crtend.o /usr/lib/crtn.o

Running tpw

./tpw
limit.h
Checking long; min is -2147483648, max is 2147483647
limit
Checking wchar_t; min is 0, max is -1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]