IBM Support

LI76567: #INCLUDE_NEXT SEARCHING SAME DIRECTORY

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • When compiling with the C compiler, the directory search
    sequence for include files has incorrect behaviour when
    duplicate search directories are specified.  This can cause
    unexpected behaviour when the #include_next preprocessor
    directive used:
    
    
    $ cat t.c
    #include "t.h"
    
    int main() { printf("%d\n", ret_val); }
    $ cat ./path1/t.h
    #include_next "t.h"
    
    int ret_val = RET;
    $ cat ./path2/t.h
    #define RET 55;
    $
    
    Compiling with the following works as expected:
    $ xlc -I./path1 -I./path2 t.c
    
    But adding ./path1 again to the compile line, the following
    error is output:
    
    $ xlc -I./path1 -I./path1 -I./path2 t.c -qlist
    "./path1/t.h", line 3.5: 1506-334 (S) Identifier ret_val has
    already been defined on line 3 of "./path1/t.h".
    
    The listing shows that ./path1 is searched twice
    >>>>> FILE TABLE SECTION <<<<<
    
    FILE CREATION        FROM
    FILE NO   FILENAME                    DATE       TIME       FILE
    LINE
         0    t.c                         04/28/11   18:31:35
         1    ./path1/t.h                 04/28/11   18:30:40      0
    ==>  2    ./path1/t.h                 04/28/11   18:30:40      1
         3    ./path2/t.h                 04/28/11   18:31:01      2
    
    
    Using the C++ compiler removes duplicate directories, and
    compiles clean:
    
    $ xlC -+ -I./path1 -I./path1 -I./path2 t.c -qlist
    
    >>>>> FILE TABLE SECTION <<<<<
        1  =  ./path1/t.h
        2  =  ./path2/t.h
    

Local fix

  • Do not include duplicate paths for include file directory
    searching.
    

Problem summary

  • PROBLEM DESCRIPTION:
    Duplicate -I header file search sequence entries are not
    ignored.
    
    USERS AFFECTED:
    Users of include_next.
    

Problem conclusion

  • Duplicate -I entries are now ignored.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI76567

  • 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

    2012-01-09

  • Closed date

    2012-01-09

  • Last modified date

    2012-01-09

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

    IV01079

  • 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

  • RA10 PSY

       UP



Document information

More support for: XL C/C++

Software version: A.1

Reference #: LI76567

Modified date: 09 January 2012


Translate this page: