Skip to main content

IV31755: -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

    IV31755

  • Reported component name

    XL C FOR AIX

  • Reported component ID

    5725C7100

  • Reported release

    C10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2012-11-09

  • Closed date

    2012-11-09

  • Last modified date

    2012-11-09

  • 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 FOR AIX

  • Fixed component ID

    5725C7100

Applicable component levels

  • RC10 PSN U856101

       UP06/09/13 C

Rate this page:

(0 users)Average rating

Copyright and trademark information

IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.

Rate this page:


(0 users)Average rating

Add comments

Document information

XL C for AIX

Compiler


Software version:
12.1


Reference #:
IV31755


Modified date:
2012-11-09

Translate my page

Content navigation