Search

Compiling local static auto object causes internal compiler error by Oogle

Closed
as Fixed Help for as Fixed

1
0
Sign in
to vote
Type: Bug
ID: 696412
Opened: 10/24/2011 11:05:49 AM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
1
Workaround(s)
0
User(s) can reproduce this bug
When using the auto keyword for local static objects (not primitive types), compiling the code with release build optimizations causes a compiler crash.
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling version

Visual Studio 2010

Steps to reproduce

Using the following CL cmd line options ...
/Zi /nologo /Wall /WX- /O2 /Oi /Oy- /GL /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /Gm- /EHsc /GS /Gy /fp:precise /Za /Zc:wchar_t /Zc:forScope /GR /Fp"Release\LocalTest.pch" /Fa"Release\" /Fo"Release\" /Fd"Release\vc100.pdb" /Gd /analyze- /errorReport:queue

Compile a release build of the following code in a cpp file...

struct Test
{
    explicit Test( int ){}
};

int main(int, char*)
{
    static auto myTest( Test(0) );
    return 0;
}

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

The compiler crashes with the following error:

LocalTest.cpp(8): fatal error C1001: An internal error has occurred in the compiler.
(compiler file 'msc1.cpp', line 1420)
To work around this problem, try simplifying or changing the program near the locations listed above.
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
The command exited with code 1.

Expected results

The compiler should not crash.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 11/15/2011 at 10:13 AM
Hi:
    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 Oogle on 10/27/2011 at 3:50 PM
Thanks for being able to reproduce it. Would you happen to know which flag I can avoid/modify to allow me to still use the auto keyword? Also, should I expect this to be resolved in the next release (VS2011?)?
Posted by Microsoft on 10/27/2011 at 3:30 PM
Please disregard the previous message. It does take the exact command-line argument to reproduce it.

Tanveer Gani
Visual C++ Team.
Posted by Microsoft on 10/27/2011 at 3:24 PM
Thank you for reporting this issue to Microsoft. This has already been fixed in the next release of the compiler.

Tanveer Gani
Visual C++ Team
Posted by MS-Moderator07 [Feedback Moderator] on 10/24/2011 at 11:29 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 MS-Moderator01 on 10/24/2011 at 11:45 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 Oogle on 10/24/2011 at 11:07 AM
The workaround is to avoid using the auto keyword when creating local static objects.