HighTechTalks DotNet Forums  

Serious bug on ternary operator: ExecutionEngineException

Dotnet VJSharp microsoft.public.dotnet.vjsharp


Discuss Serious bug on ternary operator: ExecutionEngineException in the Dotnet VJSharp forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Bruno Jouhier [MVP]
 
Posts: n/a

Default Serious bug on ternary operator: ExecutionEngineException - 10-06-2004 , 04:20 PM






The following program compiles fine bug generates an
ExecutionEngineException at runtime:

package TOBugJSharp;
import System.Decimal;

public class Buggy
{
/** @property */
public Decimal get_DecimalValue() { return new Decimal(1); }

public Object GetValue(boolean withCast)
{
return withCast ? (Object)get_DecimalValue() : get_DecimalValue();
}

/** @attribute System.STAThread() */
public static void main(String[] args)
{
Buggy buggy = new Buggy();
Object val = buggy.GetValue(true);
// instanceof triggers ExecutionEngineException!
if (val instanceof String)
System.out.println("string");
else
System.out.println("other: " + val);
}
}

Also, if you change it call buggy.GetValue(false) instead of
buggy.GetValue(true), it prints
other: null
which is also wrong (if you try val.getClass() , you get an NPE!)

So, it sounds that the compiler is generating buggy IL on the ternary
operator inside GetValue, my guess is that the Decimal is not boxed
correctly and then things go wild (but I am not an IL expert).

I tried it with Whidbey and the bug is still there. So, I will post it on
the whidbey site too.

Bruno.



Reply With Quote
  #2  
Old   
wendy ferrari = maman75 (AT) hotmail (DOT) com
 
Posts: n/a

Default Serious bug on ternary operator: ExecutionEngineException - 10-07-2004 , 09:41 PM







Quote:
-----Original Message-----
The following program compiles fine bug generates an
ExecutionEngineException at runtime:

package TOBugJSharp;
import System.Decimal;

public class Buggy
{
/** @property */
public Decimal get_DecimalValue() { return new
Decimal(1); }

public Object GetValue(boolean withCast)
{
return withCast ? (Object)get_DecimalValue() :
get_DecimalValue();
}

/** @attribute System.STAThread() */
public static void main(String[] args)
{
Buggy buggy = new Buggy();
Object val = buggy.GetValue(true);
// instanceof triggers ExecutionEngineException!
if (val instanceof String)
System.out.println("string");
else
System.out.println("other: " + val);
}
}

Also, if you change it call buggy.GetValue(false)
instead of
buggy.GetValue(true), it prints
other: null
which is also wrong (if you try val.getClass() , you get
an NPE!)

So, it sounds that the compiler is generating buggy IL
on the ternary
operator inside GetValue, my guess is that the Decimal
is not boxed
correctly and then things go wild (but I am not an IL
expert).

I tried it with Whidbey and the bug is still there. So,
I will post it on
the whidbey site too.

Bruno.


.


Reply With Quote
  #3  
Old   
AT
 
Posts: n/a

Default RE: Serious bug on ternary operator: ExecutionEngineException - 10-10-2004 , 05:06 AM



Hi Bruno,

Thanks for reporting this issue in the compiler. We will be fixing this
issue in the next release of VJ#.

Amit
--------------------
Quote:
From: "Bruno Jouhier [MVP]" <bjouhier (AT) club-internet (DOT) fr
Subject: Serious bug on ternary operator: ExecutionEngineException
Date: Wed, 6 Oct 2004 22:20:37 +0200
Lines: 44
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
Message-ID: <eE$C5H#qEHA.3252 (AT) TK2MSFTNGP14 (DOT) phx.gbl
Newsgroups: microsoft.public.dotnet.vjsharp
NNTP-Posting-Host: l01v-23-55.d4.club-internet.fr 212.194.242.55
Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGXA03.phx.gbl!TK2MSFT NGP08.phx.gbl!TK2MSFTNGP14
.phx.gbl
Quote:
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.vjsharp:6474
X-Tomcat-NG: microsoft.public.dotnet.vjsharp

The following program compiles fine bug generates an
ExecutionEngineException at runtime:

package TOBugJSharp;
import System.Decimal;

public class Buggy
{
/** @property */
public Decimal get_DecimalValue() { return new Decimal(1); }

public Object GetValue(boolean withCast)
{
return withCast ? (Object)get_DecimalValue() : get_DecimalValue();
}

/** @attribute System.STAThread() */
public static void main(String[] args)
{
Buggy buggy = new Buggy();
Object val = buggy.GetValue(true);
// instanceof triggers ExecutionEngineException!
if (val instanceof String)
System.out.println("string");
else
System.out.println("other: " + val);
}
}

Also, if you change it call buggy.GetValue(false) instead of
buggy.GetValue(true), it prints
other: null
which is also wrong (if you try val.getClass() , you get an NPE!)

So, it sounds that the compiler is generating buggy IL on the ternary
operator inside GetValue, my guess is that the Decimal is not boxed
correctly and then things go wild (but I am not an IL expert).

I tried it with Whidbey and the bug is still there. So, I will post it on
the whidbey site too.

Bruno.





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.