IBM Support

LI78468: COMPILER GENERATING WRONG CODE WHEN HANDLING BIT FIELDS

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • The following test case reveals that the compiler is generating
    incorrect code when handling bit fields:
    
    ===== COMPILE COMMAND:
    cc -qlist -qsource -g -g -DISSUE -q64 -+ -c -o t.o t.c
    cc -g -o t_nak -q64 t.o
    
    ===== TESTCASE:
    #include <stdio.h>
    #include <limits.h>
    
    #define SIZE    20
    
    typedef struct S0 {
            union {
                    unsigned        u : SIZE;
                    unsigned short  us;
            } u;
    } S0;
    
    int main(void) {
            S0      s;
    
    #ifdef  ISSUE
            s.u.us = 1000;
    #endif
            s.u.u = 15;
            printf("%u\n", s.u.u);
    }
    
    
    
    ===== ACTUAL OUTPUT:
    $ ./build
    $ ./t_nak
    0
    $
    
    
    ===== EXPECTED OUTPUT:
    $ ./build
    $ ./t_ack
    15
    $
    

Local fix

  • N/A
    

Problem summary

  • USERS AFFECTED:
    XL C++ users with bitfields may be affected by this issue.
    
    PROBLEM DESCRIPTION:
    Unions that are enclosed within another class or struct causes
    wrong bitcontainer to be emitted.
    

Problem conclusion

  • A compiler fix has been made to emit correct bitcontainer.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI78468

  • Reported component name

    XL C/C++ FOR LI

  • Reported component ID

    5725C7300

  • Reported release

    D10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2015-02-25

  • Closed date

    2015-02-25

  • Last modified date

    2015-02-25

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

    IV64617

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

Fix information

  • Fixed component name

    XL C/C++ FOR LI

  • Fixed component ID

    5725C7300

Applicable component levels



Document information

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

Software version: 13.1

Reference #: LI78468

Modified date: 25 February 2015