Fixes are available
October 2009 Update for XL C/C++ for Linux, V10.1
June 2011 Update for XL C/C++ for Linux, V10.1
XL C/C++ for Linux Fix Pack 8 (January 2014 Update) for 10.1
August 2010 Update for XL C/C++ for Linux, V10.1
January 2011 Update for XL C/C++ for Linux, V10.1
January 2012 Update for XL C/C++ for Linux, V10.1
July 2012 Update for XL C/C++ for Linux, V10.1
APAR status
Closed as program error.
Error description
The C++ compiler generates bad unicode to wide character literals. C compiler works. C++ compiler fails for all versions. In the following test case, the unicode value passed to libc routine wcstombs is invalid. If correcting the value passed to wcstombs in dbx, test case returns correct output and values. $ cat main.c #include <stdio.h> #include <stdlib.h> int main( void ) { char mbsbuf[5]; char* plocale; size_t nReturn; plocale = setlocale( LC_ALL, "" ); printf( "setlocale to %s\n", plocale ); nReturn = wcstombs( mbsbuf, L"?", 5 ); printf( "After wcstombs: %s, nReturn: %d\n", mbsbuf, nReturn ); return 0; } COMMAND LINE: $ /usr/vacpp/bin/xlC main.c -qmbcs -+ $ ./a.out EXPECTED OUTPUT: setlocale to Ja_JP Ja_JP Ja_JP Ja_JP Ja_JP Ja_JP After wcstombs: ?, nReturn: 1 <=HERE!!!! ACTUAL OUTPUT: setlocale to Ja_JP Ja_JP Ja_JP Ja_JP Ja_JP Ja_JP After wcstombs: , nReturn: 2 <=HERE!!!! A reduced test case to demonstrate the problem: <file name="test_Ja_JP.c"> #include <stdio.h> #include <wchar.h> wchar_t test_wch = L'￱'; // Japanese character '￱' may be altered by CMVC wchar_t *test_wstr = L"￱"; // Japanese character '￱' may be altered by CMVC int main() { printf("%x %x\n", (unsigned int)test_wch, (unsigned int)test_wstr[0]); return 0; } </file> COMMAND LINE: $ xlc++ -+ -qmbcs test_Ja_JP.c $ ./a.out EXPECTED OUTPUT: ff71 ff71 ACTUAL OUTPUT: b1 b1
Local fix
N/A
Problem summary
USER AFFECTED: Programs which use wide character and string literals encoded in Japanese locale (Ja_JP) via -qmbcs. PROBLEMDESCRIPTION: Under -qmbcs, the bytecode produced from wide character or string literals is incorrect, if the literals are 1-byte MBCS.
Problem conclusion
Under -qmbcs, the compiler now converts wide char and string literals into the internal representation, using the mbtowc() system function, regardless whether the MBCS is 1-byte or multi-byte.
Temporary fix
Comments
APAR Information
APAR number
LI75048
Reported component name
XL C/C++ RHEL52
Reported component ID
5724U8310
Reported release
A10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2009-12-01
Closed date
2009-12-01
Last modified date
2009-12-01
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
XL C/C++ RHEL52
Fixed component ID
5724U8310
Applicable component levels
RA10 PSN IZ45044
UP06/09/13
[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SSJT9L","label":"XL C\/C++"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"A.1","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]
Document Information
Modified date:
14 October 2021