IBM Support

IV85246: FUNCTION-LIKE MACRO NOT RESOLVED CORRECTLY AFTER MULTIPLE SUBSTITUTIONS

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The C preprocessor is not substituting a function-like macro
    after multiple substitutions.  The issue may be related to the
    resolution of macros substituted into macros - i.e. the
    evaluation order of nested macros.
    
    
    
       === TEST CASE ===
    
    #define null
    
    #define run(...)           SUCCESS
    #define sub1(...)          sub2(__VA_ARGS__)
    #define sub2(_mac,_args)   sub3(_mac _args)
    #define sub3(fin)          #fin fin
    
    test()
    {
      char *cp = sub1(run,(null));
    }
    
    
       === INCORRECT OUTPUT ===
    $ xlc -E test.c
    #line 8 "test.c"
    test()
    {
            char *cp = "run()" run ();
    }
    $
    
        === CORRECT OUTPUT ===
    $ xlc -E test.c
    #line 8 "test.c"
    test()
    {
            char *cp = "run ()" SUCCESS;
    }
    $
    

Local fix

Problem summary

  • USERS AFFECTED:
    Users trying multiple substitutions in a function-like macro
    with __VA_ARGS__ maybe affected by this issue.
    
    PROBLEM DESCRIPTION:
    Preprocessor failed a substitution and generated wrong output.
    

Problem conclusion

  • Preprocessor has been fixed to handle this case.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IV85246

  • Reported component name

    XL C FOR AIX

  • Reported component ID

    5725C7100

  • Reported release

    D10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2016-05-27

  • Closed date

    2016-08-15

  • Last modified date

    2016-08-15

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

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

    IV85636

Fix information

  • Fixed component name

    XL C FOR AIX

  • Fixed component ID

    5725C7100

Applicable component levels

[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSGH2K","label":"XL C for AIX"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"13.1","Edition":"","Line of Business":{"code":"LOB73","label":"Power TPS"}}]

Document Information

Modified date:
19 August 2024