IBM Support

IJ06432: GLOBAL DESIGNATED INITIALIZER USING COMPOUND LITERAL FAILING WITH EXTC99

Subscribe

You can track all active APARs for this component.

 

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

  • RD10 PSY

       UP

[{"Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSGH2K","label":"XL C for AIX"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"13.1"}]

Document Information

Modified date:
23 September 2021