IBM Support

LI80739: WCHAR_T BRACED INITIALIZER STRING INITIALIZED TO NULL

Subscribe to this APAR

By subscribing, you receive periodic emails alerting you to the status of the APAR, along with a link to the fix after it becomes available. You can track this item individually or track all items by product.

Notify me when this APAR changes.

Notify me when an APAR for this component changes.

APAR status

  • Closed as program error.

Error description

  • A wide character, wchar_t, array initialized with a braced value
    is initialized to NULL.
    
    
       === TEST CASE ===
    
    #include <stdio.h>
    #include <wchar.h>
    
    int main()
    {
       char a1[] = "hello";
       char a2[] = {"there"};
       printf("a1 %s a2 %s %lu\n", a1, a2, sizeof(wchar_t));
    
       wchar_t s1[] =  L"hello";
       wchar_t s2[] = {L"there"};  // NULLed out
       printf("s1 %ls s2 %ls\n", s1, s2);
    
       return 0;
    }
    
    
    
    $ xlc char.c
    $ ./a.out
    a1 hello a2 there 4
    s1 hello s2
    $
    
    
    Expected Output:
    
    a1 hello a2 there 4
    s1 hello s2 there
    

Local fix

  • Do not use braced list initializer for wchar_t type
    

Problem summary

  • PROBLEM DESCRIPTION:
    The wchar_t type is interpretted incorrectly within the
    compiler, causing incorrect code to be generated for the
    initializer.
    
    USERS AFFECTED:
    Users of wchar_t arrays with braced initializers.
    

Problem conclusion

  • The type interpretation was corrected and the initializer now
    works correctly.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI80739

  • Reported component name

    XL C/C++ LINUX

  • Reported component ID

    5725C7310

  • Reported release

    G11

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2019-04-16

  • Closed date

    2019-06-21

  • Last modified date

    2019-06-21

  • 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++ LINUX

  • Fixed component ID

    5725C7310

Applicable component levels



Document information

More support for: XL C/C++ for Linux

Software version: G11

Reference #: LI80739

Modified date: 21 June 2019