cl.exe crashes with a message box compiling some specific code - by Dmitry Me

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 687931 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 9/11/2011 10:51:01 PM
Access Restriction Public


This is in fact the same as item 611376, but now being observed in version 10.0.30319.1 RTMRel.

We have this template:

template<int Degree>
struct CPowerOfTen {
    enum { Value = 10 * CPowerOfTen<Degree - 1>::Value };

struct CPowerOfTen<0> {
    enum { Value = 1 };

and we instantiate it like this:

int res = CPowerOfTen<-1>::Value;//note -1 here

When this code is compiled the compiler emits the following console output:

1>  AnalyzeTest.cpp
1>AnalyzeTest.cpp(46): fatal error C1001: An internal error has occurred in the compiler.
1>  (compiler file 'msc1.cpp', line 1411)

and then a message box is spawned (attached) that blocks cl.exe execution.

This is a major problem - the compiler gets unusable in daily builds because it requires operator intervention to continue. The compiler can issue an internal error once in a while, but it should do do into the console output only and then end without any message boxes. In no event should the compiler spawn message boxes - all top level exceptions should be caught and printed to the console and then suppressed and the compiler should just exit. A process dump is also attached.
Sign in to post a comment.
Posted by Microsoft on 4/29/2014 at 12:23 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:
Posted by Microsoft on 9/13/2011 at 3:28 PM
Thank you for your bug report. The crash you encountered is already fixed in VS2010 SP1. To prevent pop-ups from Windows error reporting, you can specify the /errorreport:queue compiler option and in the Windows control panel set error reporting to "never check for solutions".

Tanveer Gani
Visual C++ Team
Posted by Dmitry Me on 9/12/2011 at 12:42 AM
Yeap, looks like changing it to "do not send report" eliminates the message box, but it's rather unexpected that the behavior I observe is by default - it should be optional. All this time I didn't even think there was a setting - I thought there was something wrong in cl.exe error handling.
Posted by Mike Danes on 9/12/2011 at 12:37 AM
I doubt that what you are seeing is really a message box, it's more likely that it is the Windows error reporting dialog. You can get rid of it by setting "Internal Compiler Error Reporting" option (C/C++\Advanced) to "Do Not Send Report" or "Queue for next login".
Posted by EricLeong [Feedback Moderator] on 9/12/2011 at 12:28 AM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. Your issue has been routed to the appropriate VS development team for review. We will contact you if we require any additional information.
Posted by Dmitry Me on 9/12/2011 at 12:10 AM
Great, but there're also items 687790 and 687786 that indicate that the compiler is still allowed to crash with a message box. That's a major problem. I don't care how neat a console message is, I don't care what the behavior is on this specific code, I just want to be sure that if something goes fatally wrong there's no message box.
Posted by Mike Danes on 9/11/2011 at 11:59 PM
I don't get any crashes with SP1, it only displays the following compiler error:

fatal error C1202: recursive type or function dependency context too complex
Posted by MS-Moderator01 on 9/11/2011 at 11:39 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(