IV28620: INEFFICIENT STRUCT/UNION INIT OF MEMBER

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

  • 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 U856101

       UP C



Rate this page:

(0 users)Average rating

Document information


More support for:

XL C for AIX
Compiler

Software version:

12.1

Reference #:

IV28620

Modified date:

2013-03-13

Translate my page

Machine Translation

Content navigation