dotgnu-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[DotGNU]Another bug from System.Xml


From: Gopal V
Subject: [DotGNU]Another bug from System.Xml
Date: Fri, 27 Sep 2002 00:44:34 +0530
User-agent: Mutt/1.2.5i

Hi All,
        After playing around with the runtime quite a bit .. I discovered
that the errors in System.Xml.dll were not verification bugs afterall .

One of the compiler bugs which hit me in the face are attached ....
I almost know how to fix them ... But need some advice from Rhys ..

I cooked up a patch to fix up the first program code in general .. But
discovered the second program in the process ... The first patch confirms
that the return statement is the cause for ILNodeEndsInFlowChange(). 
Try throw2.cs for demonstration...

I think some code is erroneous , but need to confirm that I'm right/wrong,
because at first glance it can go either way ...

/*
 * Determine if an "if" statement ends in a return statement.
 */
ILNode_EndsInReturnImpl(ILNode_If)
{
        int flags1, flags2;
        if(node->thenClause)
        {
                flags1 = ILNode_EndsInReturnImpl(node->thenClause);
        }
        else
        {
                flags1 = IL_ENDS_IN_EMPTY;
        }
        if(node->elseClause)
        {
                flags2 = ILNode_EndsInReturnImpl(node->elseClause);
        }
        else
        {
                flags2 = IL_ENDS_IN_EMPTY;
        }
        if((flags1 & IL_ENDS_IN_EMPTY) != 0 ||
           (flags2 & IL_ENDS_IN_EMPTY) != 0)
        {
                return ((flags1 | flags2) & IL_ENDS_IN_CONTAINED_MASK);
        }
        else
        {
                return (flags1 | flags2);
        }
}

So according to this 

if(answer_to_life_universe_and_everything)return "42";
else if(who_made_earth) return "mice";

Gives an A-OK for ILNode_EndsInReturnImpl() ... So shouldn't we return
(flags1 & flags2) ?

But in that case , the following code fails to pass the test

if(answer_to_life_universe_and_everything)return "42";
else throw new QuestionException("don't know");

In a quandary, please advise....

Gopal
-- 
The difference between insanity and genius is measured by success

Attachment: throw2.cs
Description: Text document

Attachment: ret.cs
Description: Text document

Attachment: patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]