This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/8901: __WCHAR_MAX__ not defined correctly for -fshort-wchar
- From: cheinan at primus dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 11 Dec 2002 16:33:24 -0000
- Subject: c/8901: __WCHAR_MAX__ not defined correctly for -fshort-wchar
- Reply-to: cheinan at primus dot com
>Number: 8901
>Category: c
>Synopsis: __WCHAR_MAX__ not defined correctly for -fshort-wchar
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Dec 11 08:36:02 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Cheinan Marks
>Release: gcc version 3.3 20021209 (experimental)
>Organization:
>Environment:
Sun Sparc Solaris 8
>Description:
__WCHAR_MAX__ incorrectly defined when -fshort-wchar is used. It set to 32767, but a wchar_t is a short unsigned int (see __WCHAR_TYPE__) and the correct value for an unsigned short is 65535.
>How-To-Repeat:
liza:~/test> cat empty.cpp
int main()
{
return 0;
}
liza:~/test Yes Master? ~/gccsnap/gcctarget/bin/g++ -E -dM -fshort-wchar empty.cpp | grep -i wchar
#define __WCHAR_MAX__ 32767
#define __WCHAR_TYPE__ short unsigned int
#define __WCHAR_UNSIGNED__ 1
>Fix:
Workaround: Add -D__WCHAR_MAX__=65535 to command line.
>Release-Note:
>Audit-Trail:
>Unformatted: