all groups > dotnet clr > november 2005 >
You're in the

dotnet clr

group:

Major JIT Optimizer BUG


Major JIT Optimizer BUG Boaz Sedan
11/14/2005 8:01:04 AM
dotnet clr:
Try running the following code (tested on .Net1.1 SP1) in both debug and
release builds. Notice the different results:

In the release build, Method B (which modifies an instance field) is never
called!!!

------------------------------------------------------
using System;

namespace MajorBUG
{
class Class1
{
static void Main(string[] args)
{
A a = new A();
Console.WriteLine(a.data);
a.C("XYZ");
Console.WriteLine(a.data);
}
}

class A
{
public string data = "ABC";

public void C(string value)
{
if (B(value))
return;
}

public bool B(string value)
{
data = value;
return true;
}
}
}
Re: Major JIT Optimizer BUG Mattias Sjögren
11/14/2005 7:42:25 PM
[quoted text, click to view]

I can't repro it, here it prints the expected result in both builds.


Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Re: Major JIT Optimizer BUG Jon Skeet [C# MVP]
11/14/2005 10:19:46 PM
[quoted text, click to view]

Have you tried compiling it from the command line? Here are my results:

c:\test>csc /debug+ Test.cs
Microsoft (R) Visual C# .NET Compiler version 7.10.6001.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.

c:\test>test
ABC
XYZ

c:\test>csc /debug- /o+ Test.cs
Microsoft (R) Visual C# .NET Compiler version 7.10.6001.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.


c:\test>test
ABC
ABC


It seems to be okay with .NET 2.0 though.
I must say, I'm very surprised by this - I haven't seen anything=20
similar before.

I'll raise this with MS personally...

--=20
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
Re: Major JIT Optimizer BUG Mattias Sjögren
11/15/2005 6:39:18 PM

[quoted text, click to view]

Yup that's what I did, but I may have forgotten /o or ran the wrong
executable or some other stupid mistake. My bad.


Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Re: Major JIT Optimizer BUG Metallikanz!
11/27/2005 12:00:00 AM
The problem is not reproducible from VS (2003, 1.1 SP1) even in the =
retail build with the optimization thingie on.

But when we use csc it sure does come, the inconsistency baffles me!!

Metallikanz!


[quoted text, click to view]

Have you tried compiling it from the command line? Here are my results:

c:\test>csc /debug+ Test.cs
Microsoft (R) Visual C# .NET Compiler version 7.10.6001.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.

c:\test>test
ABC
XYZ

c:\test>csc /debug- /o+ Test.cs
Microsoft (R) Visual C# .NET Compiler version 7.10.6001.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.


c:\test>test
ABC
ABC


It seems to be okay with .NET 2.0 though.
I must say, I'm very surprised by this - I haven't seen anything=20
similar before.

I'll raise this with MS personally...

--=20
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
Re: Major JIT Optimizer BUG Mattias Sjögren
11/28/2005 11:37:28 PM

[quoted text, click to view]

If you launch from VS make sure you use "Start without debugging".
Otherwise the app will start with the debugger attached which changes
the JIT behavior.


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
AddThis Social Bookmark Button