IBM Support

IV28620: INEFFICIENT STRUCT/UNION INIT OF MEMBER

Fixes are available

March 2013 PTF for XL C for AIX, V12.1
March 2013 PTF for XL C/C++ for AIX, V12.1
XL C/C++ for AIX Fix Pack 4 (June 2013 PTF) for 12.1
XL C/C++ for AIX Fix Pack 5 (September 2013 PTF) for 12.1
XL C/C++ for AIX Fix Pack 7 (January 2014 PTF) for 12.1
XL C for AIX Fix Pack 8 (March 2014 PTF) for 12.1
XL C/C++ for AIX Fix Pack 8 (March 2014 PTF) for 12.1
XL C/C++ for AIX Fix Pack 11 (February 2015 PTF) for 12.1
XL C for AIX Fix Pack 12 (May 2015 PTF) for 12.1
XL C/C++ for AIX Fix Pack 12 (May 2015 PTF) for 12.1
XL C/C++ for AIX Fix Pack 13 (August 2015 Update) for 12.1
XL C/C++ for AIX Fix Pack 14 (December 2015 Update) for 12.1
XL C for AIX Fix Pack 15 (April 2016 Update) for 12.1
XL C/C++ for AIX Fix Pack 15 (April 2016 Update) for 12.1
XL C for AIX Fix Pack 16 (July 2016 Update) for 12.1
XL C/C++ for AIX Fix Pack 16 (July 2016 Update) for 12.1
XL C/C++ for AIX Fix Pack 17 (November 2016 Update) for 12.1
XL C for AIX Fix Pack 17 (November 2016 Update) for 12.1
XL C for AIX Fix Pack 18 (February 2017 Update) for 12.1
XL C/C++ for AIX Fix Pack 18 (February 2017 Update) for 12.1
XL C for AIX Fix Pack 19 (August 2017 Update) for 12.1
XL C/C++ for AIX Fix Pack 19 (August 2017 Update) for 12.1
XL C for AIX Fix Pack 20 (March 2018 Update) for 12.1
XL C/C++ for AIX Fix Pack 20 (March 2018 Update) for 12.1
XL C for AIX Fix Pack 4 (June 2013 PTF) for 12.1
XL C for AIX Fix Pack 5 (September 2013 PTF) for 12.1
XL C for AIX Fix Pack 6 (December 2013 PTF) for 12.1
XL C/C++ for AIX Fix Pack 6 (December 2013 PTF) for 12.1
XL C for AIX Fix Pack 7 (January 2014 PTF) for 12.1
XL C for AIX Fix Pack 9 (July 2014 PTF) for 12.1
XL C/C++ for AIX Fix Pack 9 (July 2014 PTF) for 12.1
XL C for AIX Fix Pack 10 (October 2014 PTF) for 12.1
XL C/C++ for AIX Fix Pack 10 (October 2014 PTF) for 12.1
XL C for AIX Fix Pack 11 (February 2015 PTF) for 12.1
XL C for AIX Fix Pack 13 (August 2015 Update) for 12.1
XL C for AIX Fix Pack 14 (December 2015 Update) for 12.1
XL C/C++ for AIX Fix Pack 21 (January 2019 Update) for 12.1
XL C for AIX Fix Pack 21 (January 2019 Update) for 12.1

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • xlC initializes struct and union member with inefficient loads
    from constant area while load immediate could be used to
    create the values that are stored to the struct/union.
    
    
    ===== COMPILE COMMAND:
    xlC -q64 -O2 -qlist -c test.C
    
    
    ===== TESTCASE:
    $ cat test.C
    struct  sqlz_value
    {
       unsigned short type;
       union
       {
          unsigned short clen;
          struct
          {
             unsigned char m;
             unsigned char n;
          } dlen;
       } len;
       unsigned char *data;
    };
    
    extern "C" void intToDec(struct sqlz_value *dec, int i);
    
    extern "C" void init(int i)
    {
       struct sqlz_value promote;
       promote.type = 2;
       promote.len.dlen.m = 11;
       promote.len.dlen.n = 0;
       intToDec(&promote, i);
    }
    $
    
    
    When looking at the provided test case, only the 0 gets loaded
    using li.
    But for 11, two loads from constant area are used.
    
     18|                                  PROC      i,gr3
        0| 000000 mfspr    7C0802A6   1     LFLR      gr0=lr
        0| 000004 ld       E8A20008   1     L8
    gr5=.+CONSTANT_AREA(gr2,0)
        0| 000008 stdu     F821FF81   1     ST8U
    gr1,#stack(gr1,-128)=gr1
       24| 00000C extsw    7C6407B4   1     EXTS4     gr4=gr3
       24| 000010 addi     38610070   1     AI        gr3=gr1,112
        0| 000014 std      F8010090   1     ST8
    #stack(gr1,144)=gr0
       23| 000018 addi     38000000   1     LI        gr0=0
       23| 00001C stb      98010073   1     ST1Z
    <a1:d115:l1>(gr1,115)=gr0
       22| 000020 lhz      A0050000   1     L2Z
    gr0=+CONSTANT_AREA(gr5,0) <---- here
       22| 000024 lbz      88A50002   1     L1Z
    gr5=+CONSTANT_AREA(gr5,2) <---- here
       22| 000028 sth      B0010070   1     ST2Z
    promote.|type@0#11|m@2#12_1(gr1,112)=gr0
       22| 00002C stb      98A10072   1     ST1Z
    promote.|type@0#11|m@2#12_1(gr1,114)=gr5
       24| 000030 bl       4BFFFFD1   1     CALL
    intToDec,2,promote",gr3,gr4,#ProcAlias",intToDec",fcr",gr1,cr[01
    567]",gr0",gr3"-gr12",fp0"-fp13",mq",lr",fcr",xer",fsr",ca",ctr"
       24| 000034 ori      60000000   1
       25| 000038 ld       E9810090   1     L8
    gr12=#stack(gr1,144)
       25| 00003C addi     38210080   1     AI        gr1=gr1,128
       25| 000040 mtspr    7D8803A6   1     LLR       lr=gr12
       25| 000044 bclr     4E800020   1     BA        lr
    

Local fix

  • n/a
    

Problem summary

  • TBD
    

Problem conclusion

  • TBD
    

Temporary fix

Comments

APAR Information

  • APAR number

    IV28620

  • Reported component name

    XL C/C++ FOR AI

  • Reported component ID

    5725C7200

  • Reported release

    C10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2012-09-25

  • Closed date

    2012-11-09

  • Last modified date

    2013-03-13

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

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

    LI77123

Fix information

  • Fixed component name

    XL C FOR AIX

  • Fixed component ID

    5725C7100

Applicable component levels

  • RC10 PSY UP

       C

[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSGH2K","label":"XL C for AIX"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"12.1","Edition":"","Line of Business":{"code":"LOB73","label":"Power TPS"}}]

Document Information

Modified date:
21 August 2024