__await is broken - by Chabster

Status : 

 


1
0
Sign in
to vote
ID 1587599 Comments
Status Active Workarounds
Type Bug Repros 0
Opened 7/24/2015 6:39:51 PM
Access Restriction Public

Description

Simple app fails to fulfill its purpose. App hits int 3 instruction and then hangs forever.

My investigation shows that compiler generates invalid instructions within ConsoleApplication1.exe!wait_int$_ResumeCoro$2() function:
00007FF6166FB0F0  mov         qword ptr [rsp+8],rcx  
00007FF6166FB0F5  push        rbp  
00007FF6166FB0F6  sub         rsp,30h  
00007FF6166FB0FA  mov         qword ptr [rsp+20h],0FFFFFFFFFFFFFFFEh  
00007FF6166FB103  mov         rbp,qword ptr [$S2]  
00007FF6166FB108  mov         eax,dword ptr [rbp+20h]  
00007FF6166FB10B  mov         dword ptr [rbp+78h],eax  
00007FF6166FB10E  cmp         dword ptr [rbp+78h],5  

rbp has the address of coroutine frame, frame has two consequent 64-bit values - address of resume method and some internal state flag, which is set to 2 initially.

dword ptr [rbp+20h] - this instruction obtains the flag, but the offset is completely wrong, it must be dword ptr [rbp+8h].

So all cases of state flag switch are bypassed. default case makes the assert hit. Boom.
Sign in to post a comment.
Posted by Victor [MSFT] on 4/6/2016 at 2:54 PM
Hello,

I wanted to follow up and mention that this has been fixed in VS 2015 Update 1 and VS 2015 Update 2.

Cheers,
Victor Tong
Microsoft Visual C++ Team
Posted by Victor [MSFT] on 8/24/2015 at 1:44 PM
Hello Chabster,

Thanks for the bug report. This is indeed a bug in our product. As you have identified, we read the state flag at an incorrect offset. This only occurs when compiling with the “program database edit and continue” /ZI compiler flag. This bug will be fixed in our next release.

In the meantime, please consider using /Zi instead of /ZI. I have tested this locally with your code and we no longer emit the incorrect offset. You can change the flag under the project’s properities: Configuration Properties --> C/C++ --> General --> Debug Information Format.

If this issue is severe, causing critical business situations or blocking your product development or deployment, please go to http://support.microsoft.com or call 1-800-MICROSOFT for assistance. For Microsoft premier customers, please contact your administrator, your Technical Account Manager, or your Microsoft premier account representative.

I am closing this MSConnect item. Feel free to respond if you need anything else.

Thanks,
Victor Tong
Microsoft Visual C++ Team
Posted by Microsoft on 7/24/2015 at 7:12 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If you require immediate assistance with this issue, please contact product support at http://support.microsoft.com/oas/default.aspx?prid=15825.