IBM Support

LI75610: APPLICATION SEGFAULT WITH -O -Q

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The following test case (3 source files) have application
    runtime segmentation fault if the program is compiled on AIX5.3
    with -O -Q.
    
    Removing -Q compiles and runs fine.
    
    
    xlc -O -Q -c bug.c -o bug_inline.o
    xlc -O -Q -c main.c -o main_inline.o
    xlc -O -Q bug_inline.o main_inline.o -o bug_inline
    
    ./bug_inline
    (segmentation fault)
    
    
    ===== TESTCASE:
    /*******$ cat bug.h*******/
    typedef struct {
      int x;
    } SYMBOL;
    
    /*********$ cat bug.c*******/
    #include <stddef.h>
    #include <stdlib.h>
    #include "bug.h"
    
    //Workaround: __attribute__((noinline))
    int
    allocate(SYMBOL **symbol)
    {
      SYMBOL *temp_symbol;
    
      if ((temp_symbol = malloc(sizeof(SYMBOL))) == NULL) return -1;
      temp_symbol->x = 1;
      *symbol = temp_symbol;
    
      return 0;
    }
    
    void
    create(SYMBOL **symptr)
    {
      if (allocate(symptr)) return;
      (*symptr)->x = 1;
    }
    
    
    void create(SYMBOL **symptr);
    
    
    /*********$ cat main.c*********/
    #include "bug.h"
    
    int
    main()
    {
      SYMBOL *sym;
      create(&sym);
      return 0;
    }
    

Local fix

  • 1) Removing -Q on compile line on AIX 5.3.
    
    2) Compiling with -O -Q on AIX6.1.
    
    3) Combining the 3 source files into one file and compiliing
    with -O -Q on AIX 5.3.
    
    4) Adding __attribute__((noinline))to int allocate(SYMBOL
    **symbol) in bug.c.
    

Problem summary

  • PROBLEM DESCRIPTION: Memory corruption due to bad load/store
    swap.
    
    USERS AFFECTED:
    Programs using inlining with multiple levels of indirection for
    an argument to a function,
    some combination of pointers for the associated parameter in
    the
    function body for the compiler to generate a sequence of
    Pointer Aliasing directves
    which does not work out when using inlining.
    

Problem conclusion

  • Fixed a corner case in Intermediate Language generation which
    affects how the Inliner
    patches arguments to parameters.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI75610

  • Reported component name

    XL C/C++ SLES10

  • Reported component ID

    5724U8300

  • Reported release

    A10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2010-07-28

  • Closed date

    2010-07-28

  • Last modified date

    2010-07-28

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

    IZ66403

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

Fix information

  • Fixed component name

    XL C/C++ SLES10

  • Fixed component ID

    5724U8300

Applicable component levels

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SSJT9L","label":"XL C\/C++"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"A.1","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
15 October 2021