IBM Support

IJ06432: GLOBAL DESIGNATED INITIALIZER USING COMPOUND LITERAL FAILING WITH EXTC99

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

  • When compiling with the -qlanglvl=extc99 language level, the
    compiler is outputting invalid warning messages for a global
    designated initializer usage.  The initializer uses a compound
    literal.  The compile succeeds, but encounters a segmentation
    fault at runtime related to accessing the compound literal.
    
    
       === TEST CASE ===
    
    #include <stdio.h>
    
    struct s {
            char **c;
    };
    
    struct s st= {  .c = (char *[]){"this","that",0}  };
    
    int main(int argc,char *argv[])
    {
            printf("%s %s\n",st.c[0],st.c[1]);
            return 0;
    }
    
    
    $ xlc apar.c -qlanglvl=extc99
    "apar.c", line 7.33: 1506-196 (W) Initialization between types
    "char**" and "char*" is not allowed.
    "apar.c", line 7.40: 1506-026 (W) Number of initializers cannot
    be greater than the number of aggregate members.
    "apar.c", line 7.47: 1506-026 (W) Number of initializers cannot
    be greater than the number of aggregate members.
    $
    $ ./a.out
    Segmentation fault (core dumped)
    $
    

Local fix

  • Compiling with -qlanglvl=stdc99 works.
    

Problem summary

  • PROBLEM DESCRIPTION:
    C code containing array compound literals as initializers at
    global scope could experience run-time crashes when compiled in
    extended mode.
    
    USERS AFFECTED:
    Users of XL C compilers with code containing compound literals
    as initializers at global scope in extended mode.
    

Problem conclusion

  • A fix was applied to avoid generating incorrect code for
    initializing global variables using compound literals with
    array type.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IJ06432

  • Reported component name

    XL C FOR AIX

  • Reported component ID

    5725C7100

  • Reported release

    D10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2018-05-17

  • Closed date

    2018-12-21

  • Last modified date

    2018-12-21

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

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

    IJ08179

Fix information

  • Fixed component name

    XL C FOR AIX

  • Fixed component ID

    5725C7100

Applicable component levels



Document information

More support for: XL C for AIX
Compiler

Software version: 13.1

Reference #: IJ06432

Modified date: 21 December 2018