msvc++ 5.0 compiler optimization problem
Author |
Message |
Adam Lev #1 / 25
|
 msvc++ 5.0 compiler optimization problem
Hi, I have a few source files that will compile with zero warnings with optimizations disabled, but if I enable optimizations to maximize speed, the compiler just hangs! It doesn't crash, it just does a bit of work but the compilation will never finish! For one of my source files, I have traced down a procedure that causes this effect. Of course there is absolutely nothing wrong with it (that I can see). Has anyone experienced this problem? I have not applied any of the service packs. Any information would be most appreciated. Regards, Adam.
|
Thu, 18 May 2000 03:00:00 GMT |
|
 |
Don Grasberg #2 / 25
|
 msvc++ 5.0 compiler optimization problem
Quote: >I have a few source files that will compile with zero warnings with >optimizations disabled, but if I enable optimizations to maximize >speed, the compiler just hangs! >It doesn't crash, it just does a bit of work but the compilation will >never finish! >For one of my source files, I have traced down a procedure that >causes this effect. Of course there is absolutely nothing wrong >with it (that I can see). >Has anyone experienced this problem? >I have not applied any of the service packs. >Any information would be most appreciated.
I seen the optimizer break a program (unoptimized compiles work correctly, optimized don't), but never seen it hang the compiler. Service packs may or may not fix the problem. You can use a pragma to disable optimizations for the problem function only. You can even report the bug to Microsoft, just don't expect to see the compiler fixed. Don Grasberger (remove --- from address to e-mail)
|
Fri, 19 May 2000 03:00:00 GMT |
|
 |
Andy Y #3 / 25
|
 msvc++ 5.0 compiler optimization problem
Quote:
>>I have a few source files that will compile with zero warnings with >>optimizations disabled, but if I enable optimizations to maximize >>speed, the compiler just hangs! >>It doesn't crash, it just does a bit of work but the compilation will >>never finish! >>For one of my source files, I have traced down a procedure that >>causes this effect. Of course there is absolutely nothing wrong >>with it (that I can see). >>Has anyone experienced this problem? >>I have not applied any of the service packs. >>Any information would be most appreciated. >I seen the optimizer break a program (unoptimized compiles work >correctly, optimized don't), but never seen it hang the compiler. >Service packs may or may not fix the problem. >You can use a pragma to disable optimizations for the problem function >only. You can even report the bug to Microsoft, just don't expect to >see the compiler fixed.
This problem has been acknowledged by Microsoft. I have the SAME problem. My workaround was to just compile the offending modules using 'default' optimization (not 'debug'). MS claims the fix will be in SP3. --------------------------------------------------------------------------------
Principal Software Engineer Corporate Web Page: http://www.xiotech.com
Eden Prairie, MN Personal Home Page: http://www.visi.com/~nde "Question authority...and the authorities will end up questioning YOU!" --------------------------------------------------------------------------------
|
Fri, 19 May 2000 03:00:00 GMT |
|
 |
Matthew T Elli #4 / 25
|
 msvc++ 5.0 compiler optimization problem
Quote:
>This problem has been acknowledged by Microsoft. I have the SAME problem. >My workaround was to just compile the offending modules using 'default' >optimization (not 'debug'). MS claims the fix will be in SP3.
Any idea when MS will be releasing SP3? (Not that I expect this to be a firm date...) Matthew Ellis
|
Fri, 19 May 2000 03:00:00 GMT |
|
 |
Adam Lev #5 / 25
|
 msvc++ 5.0 compiler optimization problem
Quote:
>This problem has been acknowledged by Microsoft. I have the SAME problem. >My workaround was to just compile the offending modules using 'default' >optimization (not 'debug'). MS claims the fix will be in SP3.
Hi Andy: Did Microsoft give you explicit information about why the compile does stop? Perhaps, it is some characteristic of my source I can change. I guess I will just use a pragma, as suggested by someone else, to disable optimizations for the 'offending' code. It isn't much fun tracking it down though :( Regards, Adam Levar.
|
Wed, 24 May 2000 03:00:00 GMT |
|
 |
Andy Y #6 / 25
|
 msvc++ 5.0 compiler optimization problem
Quote:
>>This problem has been acknowledged by Microsoft. I have the SAME problem. >>My workaround was to just compile the offending modules using 'default' >>optimization (not 'debug'). MS claims the fix will be in SP3. >Hi Andy: >Did Microsoft give you explicit information about why the compile does >stop? Perhaps, it is some characteristic of my source I can change. >I guess I will just use a pragma, as suggested by someone else, to >disable optimizations for the 'offending' code. It isn't much fun >tracking it down though :(
Something to do with inlining functions. I have a SMALL test project that demonstrates this bug, and will certainly test that project when I get SP3. --------------------------------------------------------------------------------
Principal Software Engineer Corporate Web Page: http://www.xiotech.com
Eden Prairie, MN Personal Home Page: http://www.visi.com/~nde "Question authority...and the authorities will end up questioning YOU!" --------------------------------------------------------------------------------
|
Fri, 26 May 2000 03:00:00 GMT |
|
 |
Adam Lev #7 / 25
|
 msvc++ 5.0 compiler optimization problem
Quote:
>Something to do with inlining functions. I have a SMALL test project that >demonstrates this bug, and will certainly test that project when I get SP3.
Hmm, I don't think my offending function was being inlined. I know that I did turn off all the inlining ability of the compiler. Of course, that doesn't mean is wasn't trying too. I will let you know the results of my compiles when I get SP3 as well. Regards, Adam .
|
Sat, 27 May 2000 03:00:00 GMT |
|
 |
Andy Y #8 / 25
|
 msvc++ 5.0 compiler optimization problem
Quote:
>> >This problem has been acknowledged by Microsoft. I have the SAME problem. >> >My workaround was to just compile the offending modules using 'default' >> >optimization (not 'debug'). MS claims the fix will be in SP3. >> Hi Andy: >> Did Microsoft give you explicit information about why the compile does >> stop? Perhaps, it is some characteristic of my source I can change. >> I guess I will just use a pragma, as suggested by someone else, to >> disable optimizations for the 'offending' code. It isn't much fun >> tracking it down though :( >> Regards, >> Adam Levar. >Please Disable optimizations outright unless you have a good reason >not to.
Optimizations (except for one offending module, where I use 'default') work just fine for me...If I find a problem, I'll work around it... --------------------------------------------------------------------------------
Principal Software Engineer Corporate Web Page: http://www.xiotech.com
Eden Prairie, MN Personal Home Page: http://www.visi.com/~nde "Question authority...and the authorities will end up questioning YOU!" --------------------------------------------------------------------------------
|
Sun, 28 May 2000 03:00:00 GMT |
|
 |
Doug Harris #9 / 25
|
 msvc++ 5.0 compiler optimization problem
Quote:
>Please Disable optimizations outright unless you have a good reason >not to. >There should be a warning in very BOLD LETTERS to developers about >this issue when you buy VC++. >I love Microsoft, but this makes me mad because It has cost me a lot >of productivity. >This bug was in VC 4.0 too. >Basically, If they cant get the optimizations right, why don't they >disable that option entirely?
You have to expect some bugs in programs as complex as a C++ compiler and optimizer, but in my experience, the VC++ 2-5 optimizers have demonstrated about the greatest power/bug ratio of any optimizer I've used. I've found many more bugs in the compiler proper than I have in the optimizer, but that doesn't mean I'm going to revert to assembly any time soon. Also, the VC5 compiler isn't buggy enough to provoke me to try another compiler, which, come to think of it, is one of the major reasons that led me to buy VC2 several years ago. I think the VC++ optimizer often gets a bad rap, though there certainly were some new, frequently encountered problems in VC5 that had to be addressed by service packs. You didn't give specific reasons for your views, but I've run across others who suggest never to use optimizers, and I've found they often: a. compile with optimizations infrequently, or only late in the development cycle; b. can't or don't want to spend the time to track down a problem due to an optional compile step; c. use aggressive optimizer options such as -Oa without fully understanding the consequences and restrictions; d. mistake problems in their own code, revealed by the optimizer, for optimizer bugs. Swearing off optimizers due to (a) is especially unfortunate, because in the immediate frustration of encountering an optimizer bug, people tend to forget bugs in the compiler proper that they've had to work around in the preceding months. The poor optimizer takes all the blame, when it really may be (much) less buggier than the compiler proper. I think (b) can be a valid reason, but given the straightforward but large, slow code generated without optimization, I think you have to justify *not* using the optimizer for programs you intend to distribute. That said, I think the default optimization setting for "release builds" should be -O1, instead of -O2, partly due to the aggressive inlining of non-inline template functions performed by -O2 (and in VC versions prior to 5, -O1 and any configuration that includes -Ob1), which paradoxically can result in slower code, due to cache and paging effects. -- Doug Harrison
|
Sun, 28 May 2000 03:00:00 GMT |
|
 |
Doug Harris #10 / 25
|
 msvc++ 5.0 compiler optimization problem
Quote: >I have a few source files that will compile with zero warnings with >optimizations disabled, but if I enable optimizations to maximize >speed, the compiler just hangs! >It doesn't crash, it just does a bit of work but the compilation will >never finish! >For one of my source files, I have traced down a procedure that >causes this effect. Of course there is absolutely nothing wrong >with it (that I can see). >Has anyone experienced this problem?
With the compiler proper, yes, but not the optimizer. Quote: >I have not applied any of the service packs.
Can you distill the problem into a short, self-sufficient example? That's essential to seeing the problem fixed or even getting reliable confirmation. Have you tried -O1 (minimize space)? Definitely apply the service packs! I haven't received SP3 yet, but SP2 cleared up some problems without introducing any new ones. If all else fails, you can disable optimizations for the offending function, but I strongly suggest you spend a few minutes trying to devise a reproducible test case first. -- Doug Harrison
|
Sun, 28 May 2000 03:00:00 GMT |
|
 |
Adam Lev #11 / 25
|
 msvc++ 5.0 compiler optimization problem
Well, I have gone and installed SP3 and guess what! I can't even get into the IDE anymore!!! Arg! I get the message: Cannot load package 'devdtg' beause its internal version number does not match the Devstudio shell etc. Has anyone encountered this error? Regards, Adam.
|
Mon, 29 May 2000 03:00:00 GMT |
|
 |
Ray Brow #12 / 25
|
 msvc++ 5.0 compiler optimization problem
Yes, I have. It turned out that the SP install program decided not to update any files that lived under the SharedIDE directory tree. This happened under NT. Even multiple attempts at installing the SP did not remedy this. The ultimate solution was to uninstall DevStudio altogether and reinstall. It was then that the SP install cooperated. -- ________________________________________________________________ Ray Brown Home: (612) 892-7329 Lawson Software Office: (612) 379-8086 x4393 1300 Godward Street Fax: (612) 379-8512
________________________________________________________________ Quote:
>Well, I have gone and installed SP3 and guess what! I can't even get >into the IDE anymore!!! >Arg! >I get the message: >Cannot load package 'devdtg' beause its internal version number does >not match the Devstudio shell etc. >Has anyone encountered this error?
|
Mon, 29 May 2000 03:00:00 GMT |
|
 |
Adam Lev #13 / 25
|
 msvc++ 5.0 compiler optimization problem
Quote:
>Something to do with inlining functions. I have a SMALL test project that >demonstrates this bug, and will certainly test that project when I get SP3.
Hi Andy, This is the code that would not compile for me. Note: SP3 is the first service package that I have installed. void Matrix3Similarity(matrix3_t A, matrix3_t in, matrix3_t out) { matrix3_t mtemp; // compute A*I mtemp[0][0] = A[0][0]*in[0][0] + A[0][1]*in[1][0] + A[0][2]*in[2][0]; mtemp[0][1] = A[0][0]*in[0][1] + A[0][1]*in[1][1] + A[0][2]*in[2][1]; mtemp[0][2] = A[0][0]*in[0][2] + A[0][1]*in[1][2] + A[0][2]*in[2][2]; mtemp[1][0] = A[1][0]*in[0][0] + A[1][1]*in[1][0] + A[1][2]*in[2][0]; mtemp[1][1] = A[1][0]*in[0][1] + A[1][1]*in[1][1] + A[1][2]*in[2][1]; mtemp[1][2] = A[1][0]*in[0][2] + A[1][1]*in[1][2] + A[1][2]*in[2][2]; mtemp[2][0] = A[2][0]*in[0][0] + A[2][1]*in[1][0] + A[2][2]*in[2][0]; mtemp[2][1] = A[2][0]*in[0][1] + A[2][1]*in[1][1] + A[2][2]*in[2][1]; mtemp[2][2] = A[2][0]*in[0][2] + A[2][1]*in[1][2] + A[2][2]*in[2][2]; // t // compute (A*I)*A out[0][0] = mtemp[0][0]*in[0][0] + mtemp[0][1]*in[0][1] + mtemp[0][2]*in[0][2]; out[0][1] = mtemp[0][0]*in[1][0] + mtemp[0][1]*in[1][1] + mtemp[0][2]*in[1][2]; out[0][2] = mtemp[0][0]*in[2][0] + mtemp[0][1]*in[2][1] + mtemp[0][2]*in[2][2]; out[1][0] = mtemp[1][0]*in[0][0] + mtemp[1][1]*in[0][1] + mtemp[1][2]*in[0][2]; out[1][1] = mtemp[1][0]*in[1][0] + mtemp[1][1]*in[1][1] + mtemp[1][2]*in[1][2]; out[1][2] = mtemp[1][0]*in[2][0] + mtemp[1][1]*in[2][1] + mtemp[1][2]*in[2][2]; out[2][0] = mtemp[2][0]*in[0][0] + mtemp[2][1]*in[0][1] + mtemp[2][2]*in[0][2]; out[2][1] = mtemp[2][0]*in[1][0] + mtemp[2][1]*in[1][1] + mtemp[2][2]*in[1][2]; out[2][2] = mtemp[2][0]*in[2][0] + mtemp[2][1]*in[2][1] + mtemp[2][2]*in[2][2]; Quote: }
Pretty simple! But anyway it seems to compile properly with optimizations under SP3 Regards, Adam.
|
Tue, 30 May 2000 03:00:00 GMT |
|
 |
#14 / 25
|
 msvc++ 5.0 compiler optimization problem
|
Fri, 19 Jun 1992 00:00:00 GMT |
|
|
Page 1 of 2
|
[ 25 post ] |
|
Go to page:
[1]
[2] |
|