S
Sune Foldager
Greetings,
When compiling the following example, Visual Studio 2008 (or rather the compiler
it invokes), crashes. The most reduced example I could come up with to provoke
this bug, is the following (compile as a console application, for instance):
----------
using System;
namespace Test
{
class Program
{
static void Main(string[] args)
{
var o = new Object();
// If this line is removed, the crash goes away.
lock (o) ;
// Extra code at this point (at least to some extent) won't affect
the crash.
lock (o) // <-- If we use { } around the inner statement, the crash
goes away.
if(true) // <-- This line can also be lock(o), while(false) or something
else.
{
int i; // <-- If no variable is declared, the crash goes away.
}
}
}
}
----------
The bug is, somewhat surprisingly, reported as being in the EMITIL phase:
------ Build started: Project: Test, Configuration: Debug Any CPU ------
C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702
/errorreportrompt /warn:4 /defineEBUG;TRACE /reference:"C:\Program Files\Reference
Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program
Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll"
/reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll
/reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll
/reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll"
/debug+ /debug:full /filealign:512 /optimize- /outbj\Debug\Test.exe /target:exe
Program.cs Properties\AssemblyInfo.cs
C:\Users\sune.foldager\Test\Program.cs(12,16): warning CS0642: Possible mistaken
empty statement
C:\Users\sune.foldager\Test\Program.cs(19,15): warning CS0168: The variable
'i' is declared but never used
error CS0583: Internal Compiler Error (0xc0000005 at address 65790140): likely
culprit is 'EMITIL'.
An internal error has occurred in the compiler. To work around this problem,
try simplifying or changing the program near the locations listed below.
Locations at the top of the list are closer to the point at which the internal
error occurred. Errors such as this can be reported to Microsoft by using
the /errorreport option.
C:\Users\sune.foldager\Test\Program.cs(7,17): error CS0584: Internal Compiler
Error: stage 'EMITIL' symbol 'Test.Program.Main(string[])'
C:\Users\sune.foldager\Test\Program.cs(7,17): error CS0584: Internal Compiler
Error: stage 'CODEGEN' symbol 'Test.Program.Main(string[])'
C:\Users\sune.foldager\Test\Program.cs(7,17): error CS0584: Internal Compiler
Error: stage 'COMPILE' symbol 'Test.Program.Main(string[])'
C:\Users\sune.foldager\Test\Program.cs(7,17): error CS0584: Internal Compiler
Error: stage 'COMPILE' symbol 'Test.Program.Main(string[])'
C:\Users\sune.foldager\Test\Program.cs(5,9): error CS0584: Internal Compiler
Error: stage 'COMPILE' symbol 'Test.Program'
C:\Users\sune.foldager\Test\Program.cs(3,11): error CS0584: Internal Compiler
Error: stage 'COMPILE' symbol 'Test'
C:\Users\sune.foldager\Test\Program.cs: error CS0584: Internal Compiler Error:
stage 'COMPILE' symbol '<global namespace>'
C:\Users\sune.foldager\Test\Program.cs: error CS0586: Internal Compiler Error:
stage 'COMPILE'
error CS0587: Internal Compiler Error: stage 'COMPILE'
error CS0587: Internal Compiler Error: stage 'EMIT'
error CS0587: Internal Compiler Error: stage 'BEGIN'
Compile complete -- 12 errors, 2 warnings
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
Sincerly,
Sune Foldager
Edlund A/
When compiling the following example, Visual Studio 2008 (or rather the compiler
it invokes), crashes. The most reduced example I could come up with to provoke
this bug, is the following (compile as a console application, for instance):
----------
using System;
namespace Test
{
class Program
{
static void Main(string[] args)
{
var o = new Object();
// If this line is removed, the crash goes away.
lock (o) ;
// Extra code at this point (at least to some extent) won't affect
the crash.
lock (o) // <-- If we use { } around the inner statement, the crash
goes away.
if(true) // <-- This line can also be lock(o), while(false) or something
else.
{
int i; // <-- If no variable is declared, the crash goes away.
}
}
}
}
----------
The bug is, somewhat surprisingly, reported as being in the EMITIL phase:
------ Build started: Project: Test, Configuration: Debug Any CPU ------
C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702
/errorreportrompt /warn:4 /defineEBUG;TRACE /reference:"C:\Program Files\Reference
Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program
Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll"
/reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll
/reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll
/reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll"
/debug+ /debug:full /filealign:512 /optimize- /outbj\Debug\Test.exe /target:exe
Program.cs Properties\AssemblyInfo.cs
C:\Users\sune.foldager\Test\Program.cs(12,16): warning CS0642: Possible mistaken
empty statement
C:\Users\sune.foldager\Test\Program.cs(19,15): warning CS0168: The variable
'i' is declared but never used
error CS0583: Internal Compiler Error (0xc0000005 at address 65790140): likely
culprit is 'EMITIL'.
An internal error has occurred in the compiler. To work around this problem,
try simplifying or changing the program near the locations listed below.
Locations at the top of the list are closer to the point at which the internal
error occurred. Errors such as this can be reported to Microsoft by using
the /errorreport option.
C:\Users\sune.foldager\Test\Program.cs(7,17): error CS0584: Internal Compiler
Error: stage 'EMITIL' symbol 'Test.Program.Main(string[])'
C:\Users\sune.foldager\Test\Program.cs(7,17): error CS0584: Internal Compiler
Error: stage 'CODEGEN' symbol 'Test.Program.Main(string[])'
C:\Users\sune.foldager\Test\Program.cs(7,17): error CS0584: Internal Compiler
Error: stage 'COMPILE' symbol 'Test.Program.Main(string[])'
C:\Users\sune.foldager\Test\Program.cs(7,17): error CS0584: Internal Compiler
Error: stage 'COMPILE' symbol 'Test.Program.Main(string[])'
C:\Users\sune.foldager\Test\Program.cs(5,9): error CS0584: Internal Compiler
Error: stage 'COMPILE' symbol 'Test.Program'
C:\Users\sune.foldager\Test\Program.cs(3,11): error CS0584: Internal Compiler
Error: stage 'COMPILE' symbol 'Test'
C:\Users\sune.foldager\Test\Program.cs: error CS0584: Internal Compiler Error:
stage 'COMPILE' symbol '<global namespace>'
C:\Users\sune.foldager\Test\Program.cs: error CS0586: Internal Compiler Error:
stage 'COMPILE'
error CS0587: Internal Compiler Error: stage 'COMPILE'
error CS0587: Internal Compiler Error: stage 'EMIT'
error CS0587: Internal Compiler Error: stage 'BEGIN'
Compile complete -- 12 errors, 2 warnings
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
Sincerly,
Sune Foldager
Edlund A/