IBM Support

LI72864: \X TRUNCATION OF UNICODE CHARACTERS USING -QUTF WITH XL C++ V8.0

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • XL C++ V7 and V8 using the -qutf option outputs a warning
    message when using the \x escape sequence combined with the UTF
    literal syntax (u'character').  The warning appears when the
    escape sequence is larger than 255.
    
    
    ===== TEST CASE =====
    
    #include<stdio.h>
    
    main() {
    printf("\nu\"a\"[0] == 0x%04x\n", (unsigned int)u"a"[0]);
    printf("u\"\\x61\"[0] == 0x%04x\n", (unsigned int)u"\x61"[0]);
    printf("u\"\\x0061\"[0] == 0x%04x\n", (unsigned
    int)u"\x0061"[0]);
    printf("u\"\\x6100\"[0] == 0x%04x\n", (unsigned
    int)u"\x6100"[0]);
    
    printf("u\'a\' == 0x%04x\n", (unsigned int)u'a');
    printf("u\'\\x61\' == 0x%04x\n", (unsigned int)u'\x61');
    printf("u\'\\x0061\' == 0x%04x\n", (unsigned int)u'\x0061');
    printf("u\'\\x6100\' == 0x%04x\n\n", (unsigned int)u'\x6100');
    }
    
    
    ===== COMPILE =====
    xlC -qutf test.cpp
    

Local fix

  • Use the universal character name escape sequence with form:
    \u#### (# = hex digit) instead of the hex escape sequence.
    

Problem summary

  • \x inside a u or U literal.
    
    Previously \x is processed like \u or \U depending on the
    containing literal.  For consistency with L literals (see 2.13.2
    paragraph 4) any number of digits should be accepted for a \x
    character sequence.
    

Problem conclusion

  • Processing of \x in utf-16 and utf-32 literals has
    been changed to be consistent with \x in wchar_t
    literals.  Binary compatibility is not a problem here,
    any \x value greater than 0xFF was previously
    generating warning: 1540-0812 (W) The escape
    sequence "\x100" is out of range. Value is
    truncated.  For value [0, 0xFF] the character value remains
    unchanged.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI72864

  • Reported component name

    XLC/C++ RHEL4

  • Reported component ID

    5724M1610

  • Reported release

    800

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2007-12-13

  • Closed date

    2007-12-13

  • Last modified date

    2007-12-13

  • APAR is sysrouted FROM one or more of the following:

    IY99131

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    XLC/C++ RHEL4

  • Fixed component ID

    5724M1610

Applicable component levels

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SSJT9L","label":"XL C\/C++"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"8.0","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
16 October 2021