c/8901: __WCHAR_MAX__ not defined correctly for -fshort-wchar

cheinan@primus.com cheinan@primus.com
Wed Dec 11 08:36:00 GMT 2002


>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:



More information about the Gcc-prs mailing list