HomeAbout Us A-Z IndexSearch * Contact Us Register LoginPress Shop

The Open Brand -- Problem Reporting and Interpretations System


Problem Report 1712 Details

Help Show help | Quick Search | Submit a Test Suite Support Request | Click here to view your privileges

This page provides all information on Problem Report 1712.


Report 1712 Actions


    Problem Report Number 1712
    Submitter's Classification Test Suite problem
    State Resolved
    Resolution Rejected (REJ)
    Problem Resolution ID REJ.X.0495
    Raised 1970-01-01 08:00
    Updated 2003-03-13 08:00
    Published null
    Product Standard Window System Application Interface V2
    Certification Program The Open Brand certification program
    Test Suite VSW version 5.0.0
    Test Identification Xlib7/XAllocNamedColor 4
    Problem Summary PG4W.00089 This IR claims that the test is using non-conforming ANSI C code.
    Problem Text
    This test case [file: tset/Xlib7/allcnmdclr/allcnmdclr.m] initialises
    the character string 'goodname' with XT_GOOD_COLORNAME from the
    configuration file. It copies 'goodname' to the character array 'casename'
    and then it modifies the string in casename, so that casename uses lower
    and upper case characters alternating. The modification is done around
    line 322 of the file allcnmdclr.m:

    casename = (char *) malloc( strlen(goodname) + 1);
    strcpy(casename, goodname);

    for(i=0, cp=casename; *cp; i++)
    if(i&1)
    *cp++ = tolower(*cp);
    else
    *cp++ = toupper(*cp);

    Due to the ANSI standard X3.159-1989 for the C programming language,
    chapter 3.3 "Expressions" the order of evaluation for the expressions
    in the lines
    *cp++ = tolower(*cp);
    or
    *cp++ = toupper(*cp);
    is undefined. Therefore a ANSI C compliant C compiler is allowed to generate
    code that modifies the color name "red" to the string "Ed". This happens
    with the SNI C compiler. Due to the fact that a following XAllocNamedColor
    for the color name "Ed" fails, this test case fails also. The case case
    passes if the code in the test case is modified as follows:

    casename = (char *) malloc( strlen(goodname) + 1);
    strcpy(casename, goodname);

    for(i=0, cp=casename; *cp; i++, cp++)
    if(i&1)
    *cp = tolower(*cp);
    else
    *cp = toupper(*cp);

    We view this as non ANSI C conformant programming and therefore we
    thinh that this is a problem of the test case.
    Test Output
    SECTION: Xlib7

    TEST CASE: XAllocNamedColor

    TEST PURPOSE #4
    Assertion XAllocNamedColor-4.(A)
    Upper and lower case characters in the color_name argument
    refer to the same colour.
    METH: For each supported visual type:
    METH: Create a colomap with alloc set to AllocNone.
    METH: Allocate a read/only cell with colour name XT_GOOD_COLORNAME
    METH: in the colourmap with XAllocNamedColor.
    METH: Allocate a read/only cell with colour name XT_GOOD_COLORNAME,
    METH: with alternate characters in alternating case,
    METH: in the colourmap with XAllocNamedColor.
    METH: Verify that the function returned non-zero.
    METH: Verify that the exact and closest supported rbg
    values from both calls
    METH: are identical.
    METH: Verify that the pixel value of the cell allocated by both calls
    METH: is the same.
    REPORT: XAllocNamedColor failed to return non-zero with color Ed.
    REPORT: XAllocNamedColor failed to return non-zero with color Ed.
    REPORT: XAllocNamedColor failed to return non-zero with color Ed.
    REPORT: XAllocNamedColor failed to return non-zero with color Ed.
    REPORT: XAllocNamedColor failed to return non-zero with color Ed.
    REPORT: XAllocNamedColor failed to return non-zero with color Ed.
    FAIL

    Review Information

    Review Type TSMA Review
    Start Date null
    Completed null
    Status Complete
    Review Recommendation No Resolution Given
    Review Response
    We recommend this request be refused.

    In a statement such as the following:

    *cp++ = toupper(*cp);

    ANSI C states in section 6.3.16.1 in the Semantics section for =,

    In simple assignment (=), the value of the right operand is
    converted to the type of the assignment expression and
    replaces the value stored in the object designated by the left
    operand.

    For the postfix ++ operator, the standard states in 6.3.2.4 in the
    Semantics section,

    The result of the postfix ++ operator is value of the operand.
    After the result is obtained, the value of the operand is
    incremented.

    This says that the right operand is evaluated before the left operand
    is evaluated, and the assignment is done on the old location and used
    before it is incremented.

    Thus, if cp="red", then the following sequence of events occur.

    *cp++ = toupper(*cp); /* evaluate the right side */
    *cp++ = toupper('r');
    *cp++ = 'R';
    'location of r'++ = 'R'; /* evaluate the left side */
    'location of R'++; /* evaluate the postfix ++ */
    'location of e';


    Review Type SA Review
    Start Date null
    Completed null
    Status Complete
    Review Resolution Rejected (REJ)
    Review Conclusion
    This request is refused.

    Problem Reporting System Options:

     

    Back   


Contact the Certification Authority