IBM Support

IV18500: ISSUES WITH BOOL VAL AND CC

Fixes are available

April 2012 PTF for XL C for AIX, V11.1
April 2012 PTF for XL C/C++ for AIX, V11.1
July 2012 PTF for XL C/C++ for AIX, V11.1
October 2012 PTF for XL C/C++ for AIX, V11.1
October 2012 PTF for XL C for AIX, V11.1
February 2013 PTF for XL C for AIX, V11.1
February 2013 PTF for XL C/C++ for AIX, V11.1
XL C/C++ for AIX Fix Pack 14 (May 2013 PTF) for 11.1
XL C for AIX Fix Pack 14 (May 2013 PTF) for 11.1
XL C/C++ for AIX Fix Pack 15 (August 2013 PTF) for 11.1
XL C for AIX Fix Pack 15 (August 2013 PTF) for 11.1
XL C/C++ for AIX Fix Pack 16 (November 2013 PTF) for 11.1
XL C for AIX Fix Pack 17 (February 2014 PTF) for 11.1
XL C/C++ for AIX Fix Pack 17 (February 2014 PTF) for 11.1
XL C/C++ for AIX Fix Pack 18 (May 2014 PTF) for 11.1
XL C/C++ for AIX Fix Pack 19 (August 2014 PTF) for 11.1
XL C/C++ for AIX Fix Pack 20 (November 2014 PTF) for 11.1
XL C for AIX Fix Pack 21 (April 2015 PTF) for 11.1
XL C/C++ for AIX Fix Pack 21 (April 2015 PTF) for 11.1
XL C/C++ for AIX Fix Pack 22 (September 2015 PTF) for 11.1
XL C for AIX Fix Pack 23 (March 2016 PTF) for 11.1
XL C/C++ for AIX Fix Pack 23 (March 2016 PTF) for 11.1
XL C for AIX Fix Pack 24 (September 2016 PTF) for 11.1
XL C/C++ for AIX Fix Pack 24 (September 2016 PTF) for 11.1
July 2012 PTF for XL C for AIX, V11.1
XL C for AIX Fix Pack 16 (November 2013 PTF) for 11.1
XL C for AIX Fix Pack 18 (May 2014 PTF) for 11.1
XL C for AIX Fix Pack 19 (August 2014 PTF) for 11.1
XL C for AIX Fix Pack 20 (November 2014 PTF) for 11.1
XL C for AIX Fix Pack 22 (September 2015 PTF) for 11.1

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When compiling with the cc compiler, the resulting exe produces
    an incorrect output.
    
    
    ===== COMPILE COMMAND:
    cc test.c
    
    ===== TESTCASE:
    $cat test.c
    #include <stdio.h>
    #include <stdbool.h>
    
    #ifdef THIS_WORKS
    #  define cBOOL(cbool) ((cbool) ? true : false)
    #else
    #  define cBOOL(cbool) ((bool)!!(cbool))
    #endif
    
    #define toUPPER(c) (cBOOL((c >= 'a' && c <= 'z')) ? (c - 32) :
    (c))
    
    int
    main(int argc, char **argv) {
        while (*++argv) {
            char c = **argv;
            char u = toUPPER(c);
            printf("c=%d u=%d\n", c, u);
        }
        return 0;
    }
    $
    
    
    ===== ACTUAL OUTPUT:
    $cc test.c
    $./a.out
    $ ./a.out v V
    c=118 u=86
    c=86 u=54
    $
    
    
    ===== EXPECTED OUTPUT:
    $cc test.c
    $./a.out v V
    c=118 u=86
    c=86 u=86
    $
    

Local fix

  • It will produce the expected output if you compiled the
    test case as a C++ program.
    

Problem summary

  • USERS AFFECTED:
    Users who cast a non-constant expression to _Bool may be
    affected by this issue.
    
    PROBLEM DESCRIPTION:
    Casting a non-constant expression to _Bool returns incorrect
    results.
    

Problem conclusion

  • When the expression being casted to _Bool is non-contant, the
    compiler should not just pick 0 or 1 but propagate the
    non-contant value.
    This has been corrected.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IV18500

  • Reported component name

    XL C FOR AIX

  • Reported component ID

    5724X1200

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2012-03-29

  • Closed date

    2012-03-29

  • Last modified date

    2012-04-24

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

    IV11885

  • 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

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSGH2K","label":"XL C for AIX"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"11.1","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
24 April 2012