[comp.sys.ibm.pc] Bug in Microsoft C 5.1

erc@pai.UUCP (Eric Johnson) (07/30/88)

Please add this to the list of MSC 5.1 bugs:


I just tried to run MSC 5.1 on a huge program that compiled and ran
fine in MSC 4.0, and I experienced an "Official" bug in Microsoft C 5.1.

Using the library function strcpy(), I attempted to strcpy
into a string field of a structure. The code works fine under
MSC 4.0 (DOS 3.x) and HP-UX 5.5 and 6.0 (Hewlett-Packard's Unix).

I was using the Huge memory model and Maximum optimizing.


The error was:
	fatal error C1001: Internal Compiler Error
	(compiler file '../grammar.c', line 91)
	Contact Microsoft Technical Support


Upon contacting Microsoft, I was told the error had to do with
a) /Oi optimization  (/Ox optimization (max) uses /Oi as well)
b) /AH Huge Memory Model
c) strcpy using the intrinsic functions


The solution is to use a pragma:

#pragma function(strcpy)

at the beginning of the file, to force strcpy to use the function
version, rather than the intrinsic version.

The chap on the phone was rather nice and admitted the problem had
come up before.  He had a tech note on it and suggested the 
work-around using the #pragma.


Some other complaints:

1) The installation, using the SETUP.EXE program, is terribly
complicated.  This comes, in part, from having the same product
run under OS/2 and MS-DOS.  For example, MAKE has to go under
a DOS-OS/2 combined BIN directory, while CL (compiler) and LINK
(the linker) has to go under a DOS-only directory.  I am only
using DOS, never OS/2, so why can't I install MSC executables
in the same directory (like I did with version 4.0)?  Putting
both directories in the DOS path, so DOS can find them, uses up 
precious DOS environment space.


2) The default memory model is apparently AS, the small model (why do I
hate ever having to deal with memory models in the first place?).
What this means is that if I use the compiler and specify a 
different memory model, I get an error message:

"D002: a previously defined model specification has been overridden."

Apparently, even though I am only specifying the memory model once,
the default, built into the .EXE file, has already specified
the small model (probably because I installed MSC to run small,
medium and large memory models).

This error stops Make (the manual says only that the last model
defined is the one that is used -- it is not supposed to stop make).
(Stopping the brain-damaged MS make means that make has 
detected an error and therefore quits.)

But wait, there's more.  If I use the environment variable, CL
(which can be used to set up common compiler options), and set
CL = /AL (specifying the large model), THEN make is happy and I
do not get an error that I am supposedly specifying the memory
model twice.  Yet, in this case, I AM specifying the memory model
twice: Once with the CL environment variable, and once in the
makefile.

Ideally, make compiles only those files necessary to make up
your program (only those files that have changed, or include
a file that has changed, etc.).  It is not very nice when 
make bombs on a perfectly good file.

I cannot find any mention in the manual that I can only use
make successfully if I use the CL environment variable to store
the memory model option.  What fun!

Oh yeah, and the special phone code for support given in the 5.1
documentation was wrong -- it gave me Operating Systems support
rather than language support. (For the uninitiated, when you call
Microsoft, you use your touch-tone phone -- I hope you have one --
to answer a whole bunch of questions to, hopefully, get to the
right place.  The manual gave a sequence to enter, and I tried it
-- ending up in the wrong place.

You bet I'm having fun!

If anyone has a list of bugs, please mail one to me.

-Eric

PS -- What is the state of Turbo C -- is it relatively clean 
and free of bugs?  After all this fun, I'm certainly willing
to try another compiler (MSC 4.0 has been ok in general, if
you don't use malloc -- which I always seem to do).  Could
someone post their experiences with Turbo?  Thanks.


-- 
Eric F. Johnson          | Phone +1 612-894-0313             | Are we
Prime Automation,Inc     | UUCP: bungia!pai!erc              | having
12201 Wood Lake Drive    | UUCP: sun!tundra!pai!erc          | fun
Burnsville, MN 55337 USA | BIX:  erc                         | yet?