IBM Support

IJ51032: ALIGNMENT OF STATIC_RO_DR IS NOT RESPECTED IN THE FINAL OBJECT EMITTER

Subscribe to this APAR

By subscribing, you receive periodic emails alerting you to the status of the APAR, along with a link to the fix after it becomes available. You can track this item individually or track all items by product.

Notify me when this APAR changes.

Notify me when an APAR for this component changes.

 

APAR status

  • Closed as program error.

Error description

  • The following testcase demonstrates an alignment issue for
    STATIC_RO_DR:
    
    ======COMPILE COMMAND:
    xlc test.c -q64
    
    
    ======TESTCASE:
    $ cat test.c
    #include <stdio.h>
    #include <stdint.h>
    
    /* add a byte so the compiler has to go out of its way to
    achieve alignment for
       consecutive instances */
    typedef union PGIOAlignedBlock
    {
      __attribute__((aligned(4096)))
      char            data[1 + 8192];
    } PGIOAlignedBlock;
    
    
    static const PGIOAlignedBlock al4096_static_const_initialized =
    {{0}};
    
    #define DUMP(want_align, var) dump_internal(#var, (want_align),
    &(var))
    
    static void
    dump_internal(const char *ident, unsigned want_align, const void
    *addr)
    {
      unsigned        mod = (uintptr_t) addr % want_align;
    
      printf("%-32s %4u @ 0x%p (mod %u%s)\n", ident, want_align,
    addr,
             mod, mod ? " - BUG" : "");
    }
    
    int main(int argc, char **argv)
    {
      DUMP(4096, al4096_static_const_initialized);
      return 0;
    }
    $
    
    =======ACTUAL OUTPUT:
    $./a.out
    al4096_static_const_initialized  4096 @ 0x100000650 (mod 1616 -
    BUG)
    
    
    =======EXPECTED OUTPUT:
    $./a.out
    al4096_static_const_initialized  4096 @ 0x100001000 (mod 0)
    

Local fix

  • N/A
    

Problem summary

  • USERS AFFECTED:
    Users who rely on specific alignments of unions may be affected
    by this issue.
    
    PROBLEM DESCRIPTION:
    The C++ Compiler was incorrectly aligning static readonly
    sections causing the incorrect output at runtime.
    

Problem conclusion

  • The alignment of static readonly sections is now fixed.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IJ51032

  • Reported component name

    XL C/C++ FOR AI

  • Reported component ID

    5725C7200

  • Reported release

    G10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2024-05-01

  • Closed date

    2024-05-01

  • Last modified date

    2024-05-01

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

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

Fix information

  • Fixed component name

    XL C/C++ FOR AI

  • Fixed component ID

    5725C7200

Applicable component levels

[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSGH3R","label":"XL C\/C++ for AIX"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"G10","Line of Business":{"code":"LOB73","label":"Power TPS"}}]

Document Information

Modified date:
01 May 2024