|
Home About Us A-Z Index Search * Contact Us Register Login Press ShopThe Open Brand -- Problem Reporting and Interpretations System |
Problem Report 1711 Details
Show help | Quick Search | Submit a Test Suite Support Request | Click here to view your privileges
This page provides all information on Problem Report 1711.
Report 1711 Actions
Problem Report Number 1711 Submitter's Classification Test Suite problem State Resolved Resolution Rejected (REJ) Problem Resolution ID REJ.X.0494 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/lkpclr 2 Problem Summary PG4W.00090 This IR claims that the test is using non-conforming ANSI C code. Problem Text
This test case [file: tset/Xlib7/lkpclr/lkpclr.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 200 of the file lkpclr.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
think that this is a problem of the test case.
Test Output
SECTION: Xlib7
TEST CASE: XLookupColor
TEST PURPOSE #2
Assertion XLookupColor-2.(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: Look up the rgb value of the colour name XT_GOOD_COLORNAME
METH: in the database with XLookupNamedColor.
METH: Look up the rbg value of the colour name XT_GOOD_COLORNAME,
METH: with alternating 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.
REPORT: XLookupColor failed to return non-zero with color Ed.
REPORT: XLookupColor failed to return non-zero with color Ed.
REPORT: XLookupColor failed to return non-zero with color Ed.
REPORT: XLookupColor failed to return non-zero with color Ed.
REPORT: XLookupColor failed to return non-zero with color Ed.
REPORT: XLookupColor failed to return non-zero with color Ed.
FAILReview 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:
- View Report 1711
- List All PRs
- Search Reports
- Email the System Administrator
- View the The Open Brand Interpretations Database User Manual
Contact the Certification Authority