IBM Support

LI77066: -Q64 AND -QLONGLIT CAUSES INCORRECT OUTPUT

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • Compiler incorrectly issues warning message and resulting
    binary outputs incorrect result.
    
    The following test case demonstrates the problem:
    
    $cat longtest.c
    /////////////// longtest.c ////////////////
    
    #include <stdio.h>
    #pragma pack (1)
    
    struct testst{
      char   a;
      int    b;
      char   c;
      double d;
      float  e;
    };
    
    int main() {
      struct testst st;
      unsigned long l_buff;
      l_buff = 1000000 * 2185;
      printf("%ld,0x%016lX\n", l_buff, l_buff);
      printf("%d\n", sizeof(st));
      printf("%ld\n", (long)&(st.b) - (long)&st);
      printf("%ld\n", (long)&(st.c) - (long)&(st.b));
      printf("%ld\n", (long)&(st.d) - (long)&(st.c));
      printf("%ld\n", (long)&(st.e) - (long)&(st.d));
      exit(0);
    }
    
    #pragma pack ()
    
    /////////// end of longtest.c /////////////
    
    
    Compile command:
    
    xlc -q64 -qlonglit longtest.c
    "longtest.c", line 2.15: 1506-363 (W) Packing boundary must be
    specified as one of 1, 2, 4, 8 or 16.
    "longtest.c", line 2.1: 1506-224 (W) Incorrect pragma ignored.
    "longtest.c", line 25.15: 1506-726 (W) Attempting to pop an
    empty pack stack. Current pack may change.
    
    
    
    Wrong output before applying the PTF:
    
    ./a.out
    2185000000,0x00000000823C7440
    24
    4
    4
    4
    8
    
    
    Correct output after applying the PTF:
    
    ./a.out
    2185000000,0x00000000823C7440
    18
    1
    4
    1
    8
    

Local fix

  • N/A
    

Problem summary

  • Compiler incorrectly emits message: 1506-363 (W) Packing
    boundary must be specified as one of 1, 2, 4, 8 or 16.
    

Problem conclusion

  • The problem is resolved by adjusting the length to 64 bits when
    processing 64 bit long literals.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI77066

  • Reported component name

    XL C/C++ FOR LI

  • Reported component ID

    5724X1400

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2012-10-10

  • Closed date

    2012-10-10

  • Last modified date

    2012-10-10

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

    IV26832

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

Fix information

  • Fixed component name

    XL C/C++ FOR LI

  • Fixed component ID

    5724X1400

Applicable component levels

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

Document Information

Modified date:
14 October 2021