IBM Support

IJ07800: MEMORY FAULT WITH -QIPA=PARTITION=LARGE

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 test case produces a memory fault when compiled
    with -qipa=partition=large
    
    It references the memory address for "PREV" and finds a bad
    pointer, e.g. a NULL pointer
    
    What the test-case does is to create a linked-list and to insert
    one element.
    
    
    ====COMPILE COMMAND:
    xlc -qipa=partition=large test.c
    
    
    ====TESTCASE:
    #include <stdio.h>
    
    /*  Node and header for a doubly linked list  */
    typedef struct node_t node_t;
    struct node_t
    {
        /*  Do not change the sequence of these members!  */
        node_t *Next;
        node_t *Prev;
    
        /*  Anticipate padding and make content big enough  */
        char content[sizeof(node_t *)];
    };
    
    typedef struct
    {
        node_t *First;
        node_t *Dummy; /*  is always NULL  */
        node_t *Last;
    
        void *OtherStuff1;
        void *OtherStuff2;
    }
    list_t;
    
    int main(void)
    {
        list_t mylist;
        node_t mynode0, *mynode, *lastnode;
    
        printf("================= Compile time %s\n", __TIME__);
    
        /* ******  Initialize list   ********** */
        mylist.First = (node_t *)&(mylist.Dummy);
        mylist.Dummy = NULL;
        mylist.Last = (node_t *)&(mylist.First);
    
        printf("my list is (%p): entries FIRST (%p) = %p, DUMMY (%p)
    = %p, LAST (%p) = >>>>> %p <<<<<<\n",
               &mylist,
               &(mylist.First), mylist.First, &(mylist.Dummy),
    mylist.Dummy, &(mylist.Last), mylist.Last);
    
        mynode = &mynode0;
    
        /* *****  Add "mynode" at the end of the list  ***** */
        lastnode = (node_t *)&(mylist.Dummy);
    
        printf("----------------- watch out for faulty 'PREV'!
    ----------------\n");
        printf("Last node is (%p): NEXT (%p) = %p, PREV (%p) >>>>>
    %p <<<<\n",
               lastnode, &(lastnode->Next), lastnode->Next,
    &(lastnode->Prev), lastnode->Prev);
    
        mynode->Next         = lastnode;
        mynode->Prev         = lastnode->Prev;
        lastnode->Prev->Next = mynode;  /*  << this crashes!  */
        lastnode->Prev       = mynode;
    
        return 0;
    }
    
    $
    
    
    ===== ACTUAL OUTPUT:
    $ ./a.out
    ================= Compile time 09:19:27
    my list is (2ff22560): entries FIRST (2ff22560) = 2ff22564,
    DUMMY (2ff22564) = 0, LAST (2ff22568) = >>>>> 2ff22560 <<<<<<
    ----------------- watch out for faulty 'PREV'! ----------------
    Last node is (2ff22564): NEXT (2ff22564) = 0, PREV (2ff22568)
    >>>>> 0 <<<<
    Memory fault
    $
    
    
    ===== EXPECTED OUTPUT:
    $ ./a.out
    ================= Compile time 09:23:06
    my list is (2ff22570): entries FIRST (2ff22570) = 2ff22574,
    DUMMY (2ff22574) = 0, LAST (2ff22578) = >>>>> 2ff22570 <<<<<<
    ----------------- watch out for faulty 'PREV'! ----------------
    Last node is (2ff22574): NEXT (2ff22574) = 0, PREV (2ff22578)
    >>>>> 2ff22570 <<<<
    $
    

Local fix

  • N/A
    

Problem summary

  • USERS AFFECTED:
    Users who compile with compiled with -qipa=partition=large may
    be affected by this issue.
    
    PROBLEM DESCRIPTION:
    For an internal optimization, the compiler was considering a
    zero offset when trying to access an internal object.
    

Problem conclusion

  • The compiler has been changed to consider a non-zero offset when
    trying to access an internal object.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IJ07800

  • Reported component name

    XL C FOR AIX

  • Reported component ID

    5724X1200

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2018-07-17

  • Closed date

    2018-07-17

  • Last modified date

    2018-07-17

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

    IV97966

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

Fix information

  • Fixed component name

    XL C FOR AIX

  • Fixed component ID

    5724X1200

Applicable component levels



Document information

More support for: XL C for AIX

Software version: 11.1

Reference #: IJ07800

Modified date: 17 July 2018