[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pnet-developers] Problems in ternary with upcasting
From: |
Gopal V |
Subject: |
[Pnet-developers] Problems in ternary with upcasting |
Date: |
Fri, 4 Jul 2003 14:01:55 +0530 |
User-agent: |
Mutt/1.2.5i |
Hi,
This bug is either something MS forgot to tell ECMA or
somebody didn't think verifiers were that important :)
ECMA 11.4 -- Control Flow , line number 39
4. Each slot on the stack shall have the same data type at any given point
within the method body, regardless of the control flow that allows
execution to arrive there.
So consider this code sequence
brfalse ?L1
ldloc.1 // which is class 'A'
br ?L2
?L1:
ldloc.2 // which is class 'B'
?L2:
In fact this is actually code pumped out by the MS compiler (as well as
our CSCC) for
aORb ? (Object) (a) : (Object) (b);
The entire issue revolves round the fact that the code is valid , but
not verifiable !! (at least not according to the ECMA spec :)
The issue could have been resolved by explicit "castclass" dumped in
the IL code , but "somebody had blundered" ... thankfully it's not me.
Any suggestions anyone ?
Gopal
--
The difference between insanity and genius is measured by success
ternary.cs
Description: Text document
- [Pnet-developers] Problems in ternary with upcasting,
Gopal V <=