Path: utzoo!attcan!uunet!cs.utexas.edu!news-server.csri.toronto.edu!turing.toronto.edu!west From: west@turing.toronto.edu (Tom West) Newsgroups: comp.sys.ibm.pc Subject: Re: Microsoft C 6.0 BAD code generation Message-ID: <1990Jun13.162147.11744@jarvis.csri.toronto.edu> Date: 13 Jun 90 20:21:47 GMT References: Organization: CSRI, University of Toronto Lines: 56 In article mshiels@tmsoft.UUCP (Michael A. Shiels) writes: >One of my co workers was trying to start using Microsoft C 6.0 but found out >that it's just like Microsfot C 5.1. You have to disable most of the >optimizations so it will generate correct code. Here's his very simple sample >code which doesn't have anything to do with loops but is broken when you >specify loop optimizations. Unfortunately, I can confirm this. I have a bug into MS at the moment where MSC 6.0 will produce code that eventually crashes the machine. The specifics in this case are that if you eliminate the -Oe, it works, or if you eliminate the register declaration(!!) in the register long y line, it works! Strange behaviour for an option that supposedly ignores the register keyword when turned on. (Specifically, MSC 6.0 doesn't generate enough FP stack pops and eventually overflows the FP stack). This bug is into MS along with another two, but this is the only one that generates bad code. This is scary!. My project is 300k long so I *can't* exhaustively test it for code generation bugs! What am I to do? Unfortunately, I trusted new technology too much and put in features found only in 6.0. Now it looks like I'll pay for it. On the other hand, the poor tech support contact at MS is trying to do his best. It's just there isn't a hell of a lot he can do on circumstances like this. --------------------------- cl -Oe main.c --------------------------- #include void TL1 (); _cdecl main() { for (;;) { long right = 2; double product = 1.0; if (right < 0) { long x; for (x = right; x <= -1; x++) product /= (double) 3.0; } else { register long y; for (y = right; y >= 1; y--) product *= (double) 3.0; }; TL1 (product); printf("%lf\n", product); } } void TL1 (value) double value; { } ---------------------------