Search

VC++2010 Optimize gen infinite-loop exe ... by ec-Updated

Closed
as Fixed Help for as Fixed

11
0
Sign in
to vote
Type: Bug
ID: 613573
Opened: 10/14/2010 6:35:38 AM
Access Restriction: Public
1
Workaround(s)
5
User(s) can reproduce this bug
When I disable optimizing option, the program run well,
but when I enable (-O1, -O2 -Ob1), it enter a infinite loop...

ref
attached: bug.zip, asm2.zip
bug.zip include .cpp, vcxproj, .sln files to reproduce bug.
asm2.zip include main.O1.asm main.O1.asm.htm
****
main.O1.asm is gened by
cl.exe /O1 /FAs main.cpp

main.O1.asm.htm is html version of main.O1.asm, highlight with importent section by me.

http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/aa96c5d9-bf19-4f4f-9ba8-42d29be77851
Details (expand)

Visual Studio/Silverlight/Tooling version

Visual Studio 2010

What category (if any) best represents this feedback?

 

Steps to reproduce

use vcxproj, or

cl.exe /O1 main.cpp

The program will hang at
        chkoffset=token_ind->getNextOffset(v);

Product Language

English

Operating System

Windows 7

Operating System Language

Chinese (Traditional)

Actual results

ref main.O1.asm in attached asm2.zip.

$LL3@testInline:
    mov    edx, DWORD PTR [ecx+4]

; 33 :     while(1)
; 34 :     {
; 35 :         token_ind=token_ind_s[0];
; 36 :         chkoffset=token_ind->getNextOffset(v);

$LL8@testInline:
    lea    eax, DWORD PTR [edx+4]
    mov    DWORD PTR [ecx+4], eax
    mov    eax, DWORD PTR [eax]
    mov    DWORD PTR [ecx], eax
    cmp    eax, DWORD PTR _v$[esp-4]
    jl    SHORT $LL8@testInline

; 37 :         if (chkoffset==0x7fffffff)

    cmp    eax, 2147483647                ; 7fffffffH
    jne    SHORT $LL3@testInline

Expected results

$LL3@testInline:
    mov    edx, DWORD PTR [ecx+4]

; 33 :     while(1)
; 34 :     {
; 35 :         token_ind=token_ind_s[0];
; 36 :         chkoffset=token_ind->getNextOffset(v);

    lea    eax, DWORD PTR [edx+4]
    mov    DWORD PTR [ecx+4], eax
    mov    eax, DWORD PTR [eax]
    mov    DWORD PTR [ecx], eax
    cmp    eax, DWORD PTR _v$[esp-4]
    jl    SHORT $LL3@testInline

; 37 :         if (chkoffset==0x7fffffff)

    cmp    eax, 2147483647                ; 7fffffffH
    jne    SHORT $LL3@testInline
File Attachments
File Name Submitted By Submitted On File Size  
bug.zip 10/14/2010 3 KB
asm2.zip 11/25/2010 3 KB
Sign in to post a comment.
Posted by sans_india85 on 2/23/2011 at 12:54 AM
Even, I had faced the similar problem.But I could not resolve it by installing Visual Studio 2010 SP1 beta.
Posted by Microsoft on 12/14/2010 at 12:04 PM
As always, thanks for reporting this issue. It looks like this problem was already found and fixed. Please contact us again for any new issues you find.

thanks,
VC++ Optimizer Team
Posted by ec-Updated on 12/9/2010 at 9:05 PM
Ya...
visual-studio-2010-service-pack-1-beta.aspx fixed.
Posted by ec-Updated on 12/7/2010 at 4:55 PM
http://blogs.msdn.com/b/jasonz/archive/2010/12/07/announcing-visual-studio-2010-service-pack-1-beta.aspx
Download Service Pack 1 Beta (MSDN Subscribers only)
The link for Thursday's general availability download is here.

Mmm.. Hoping Beta1 will fix the bugs... Thursday...
Posted by ec-Updated on 11/24/2010 at 9:09 PM
I'v found
http://support.microsoft.com/kb/983233/en-us
there is a hotfix about optimizaion (-Og, not exact as my condition...),
can I get it to try?
Posted by ec-Updated on 11/24/2010 at 9:03 PM


I'v downloaded vs20100 ultimate trial and clean installed on a brand new vm,
it have same bug.

cl /O1 main.cpp
or
cl /O2 /Ob1 main.cpp
will hang.
(
ps.
cl /O2 main.cpp
without /Ob1 will ok in this case,
in my real program, cl /O2 will failed too.
)

commandline version number:
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Microsoft (R) Incremental Linker Version 10.00.30319.01

Posted by ec-Updated on 11/22/2010 at 8:33 PM
I can still reproduce by .vcxproj
or use command line, cl.exe with /Ob1 option

g:\x\inline_optimize_bug>cl /O1 /Ob1 main.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.

main.cpp
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.

/out:main.exe
main.obj

g:\x\inline_optimize_bug>main
^C
g:\x\inline_optimize_bug>
Posted by Microsoft on 10/14/2010 at 6:53 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Posted by Microsoft on 10/14/2010 at 6:45 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by ec-Updated on 12/9/2010 at 9:05 PM
install visual-studio-2010-service-pack-1-beta.aspx.