Home Dashboard Directory Help

x86 C++ compiler crash by Nico Rieck



Sign in
to vote
Type: Bug
ID: 772093
Opened: 11/24/2012 8:29:10 AM
Access Restriction: Public
User(s) can reproduce this bug


The attached test case results in a C++ compiler crash. It happens with both 17.00.50727.1 and 17.00.51025 x86; x64 compiles fine.

The test case itself is heavily reduced from code involving member function pointers, with the union_cast used to retrieve the address of a member function. It seems I cannot remove anything else or the crash goes away.
Sign in to post a comment.
Posted by Microsoft on 4/29/2014 at 12:31 PM
Thank you for reporting this issue. This issue has been fixed in Visual Studio 2013. You can install a trial version of Visual Studio 2013 with the fix from: http://go.microsoft.com/?linkid=9832436
Posted by Microsoft on 12/25/2012 at 11:17 AM
    Thanks for reporting the issue.
    A fix for this issue has been checked into the compiler sources. The fix should show up in the next release of Visual C++.

Xiang Fan
Visual C++ Team
Posted by Microsoft on 11/26/2012 at 12:27 AM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 11/24/2012 at 8:51 AM
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 Nico Rieck on 11/24/2012 at 8:35 AM
Instead of union_cast these templates can be used to retrieve the address:

    template<typename T, typename R, typename... Params>
    uintptr_t memfn_addr(R (__thiscall T::*fn)(Params...))
        return *reinterpret_cast<uintptr_t*>(&fn);

    template<typename T>
    uintptr_t memfn_addr(T fn)
        return *reinterpret_cast<uintptr_t*>(&fn);
File Name Submitted By Submitted On File Size  
crash-preprocessed.cpp 11/24/2012 830 KB
crash.cpp 11/24/2012 720 bytes