c++/2644: g++ produces wrong code

Uwe F. Mayer mayer@tux.org
Wed Apr 25 13:16:00 GMT 2001


>Number:         2644
>Category:       c++
>Synopsis:       g++ produces wrong code
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 25 13:16:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Uwe F. Mayer
>Release:        3.0 20010312 (prerelease)
>Organization:
tux.org
>Environment:
System: Linux tosca 2.2.18 #2 Thu Mar 8 13:48:25 PST 2001 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --prefix=/usr/local/gcc --disable-nls
>Description:
The calls
numeric_limits<wchar_t >::digits
and
numeric_limits<wchar_t >::max()
return zero (0) instead of the limits of the type w_char.
>How-To-Repeat:
Run this code:
#include <iostream.h>
#include <limits>
using namespace std;
// needs g++ version 3
int main() {
  cout <<numeric_limits<wchar_t >::digits <<"\twchar_t digits\n";
  cout <<static_cast<int>(numeric_limits<wchar_t >::max()) <<"\twchar_t max\n";
}
>Fix:
I assume that ..../lib/gcc-lib/i686-pc-linux-gnu/3.0/include/limits.h
needs to be fixed.



>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list