[comp.windows.ms] WINDOWS 3 w/ MSC V6.0

root@scona (Corey Wirun) (06/13/90)

        I've got a program written in MSC V5.1 tht works fine with
Windows 3. When the same program is compiled with MSC V6.0, I get a
system integrity error in Windows. 

        I've used the same compiler command switches with both versions
of the compiler and there was no changes to the code itself. It's not
a large program (12K) and it doesn't use graphics. I've tried talking
to Microsoft, but of course, with all the upgrades, etc, lately, you
can't get through to anyone.


---------------------------------------------------------------------------

"This, of course, is impossible..."  - Hitchhiker's Guide to the Galaxy

   root@scona.UUCP || cwirun@uncanet.BITNET || cwirun@ucnet.ucalgary.ca

---------------------------------------------------------------------------

goodearl@world.std.com (Robert D Goodearl) (06/14/90)

In article <TmeNk1w160w@scona> root@scona (Corey Wirun) writes:
>
>        I've got a program written in MSC V5.1 tht works fine with
>Windows 3. When the same program is compiled with MSC V6.0, I get a
>system integrity error in Windows. 
>

A couple of other guys in my development group and I found a bug in C 6.0
that may be responsible for the fault you are seeing.  The bug shows up when
using getc in its macro form, and when getting the last char from the internal
buffer that getc uses.  The real problem is related to using the & operator
on the data from a char pointer and assigning the result to a register 
integer.

//The code that demonstrated the bug is as follows:

register int x;
char	*cp;

	x = 0x7f & *cp;

//or

	x = 0x7f & getc();

//When you fetch the last char in the buffer that getc uses, the above code
//will produce a memory fault because the generated code does a word fetch
//rather than a byte fetch and the last char of the buffer is on the edge of
//valid memory.  Our bug showed up when doing the 512th getc().

One solution for this bug is to do the following:

#define register

and not use explicit register variables.

Bob Goodearl -- goodearl@world.std.com

dleach@dptspd.sat.datapoint.com (David Leach) (06/14/90)

In article <TmeNk1w160w@scona> root@scona (Corey Wirun) writes:
>
>        I've got a program written in MSC V5.1 tht works fine with
>Windows 3. When the same program is compiled with MSC V6.0, I get a
>system integrity error in Windows. 
>


I would also like to know what causes a system inteegrity error in Windows.
I have a non-windows application which will get this error every so often.


-- 
David Leach

disclaimer: "I speak for no one . . . just ask my wife!"