PRB: Unresolved External __CImin Caused by /Gh /Os Options

ID Number: Q61558

6.00 6.00a 6.00ax | 6.00 6.00a

MS-DOS | OS/2

buglist6.00 buglist6.00a buglist6.00ax fixlist7.00

Summary:

SYMPTOMS

The Microsoft C Compiler versions 6.0, 6.0a, and 6.0ax produce an

incorrect reference to the symbol "__CImin" if you use the min()

macro to compare two floating-point numbers and you compile with

/Gh (generate old helper function names) and /Os (optimize for

size). The __CImin function is not actually in any of the C version

5.1 or 6.0 libraries. The sample code below may be used to

demonstrate this problem.

RESOLUTION

As a workaround, compile the module without /Os optimization or use

the optimize pragma to turn off the space optimization for the

function which uses the min() macro.

STATUS

Microsoft has confirmed this to be a problem in C versions 6.0,

6.0a, and 6.0ax. This problem was corrected in C/C++ version 7.0.

More Information:

Sample Code

-----------

/* Compile options needed: /Gh /Os

*/

#include <stdio.h>

#include <stdlib.h>

#define TESTVAL 5.0

void main (int argc, char ** argv)

{

double dValue;

if (argc > 1)

{

dValue = atof (argv[1]);

printf ("The lesser of %f and %f is %f\n",

dValue,

TESTVAL,

min (dValue, TESTVAL));

}

exit (0);

}

Additional keywords: CImin 6.00 6.00a 6.00ax