Path: utzoo!utgpu!water!watmath!clyde!feg From: feg@clyde.ATT.COM (Forrest Gehrke) Newsgroups: comp.sys.ibm.pc Subject: MSC v5 Codeview Keywords: Warning--Optimizer Message-ID: <20028@clyde.ATT.COM> Date: 11 Jan 88 17:48:11 GMT Organization: AT&T Bell Labs, Whippany, NJ Lines: 25 When compiling with the -Ox flag on, the optimzer ALWAYS tries to registerize loop variables. i.e. program(ptr) char *ptr; { while(*ptr){ ...... ...... ptr++; } } Will load ptr into the SI register and go merrily on its way using SI to access the data. However, the actual memory variable for ptr will not be updated until the loop terminates. This is great for speed, but it outsmarts Codeview. i.e. if you put a watch statement on *ptr and try to single step through the loop, Codeview doesn't know enough to watch the register instead of the memory variable and ptr, never changes. The moral here is don't use -Ox if you want to trace with Codeview or the QC in-memory debugger. Forrest Gehrke