Bug 20086

Summary: Incorrect report of error CS0165 of assigned variable.
Product: [Mono] Compilers Reporter: Lewis Cheng <lewischeng0204>
Component: C#Assignee: Marek Safar <masafa>
Status: RESOLVED FIXED    
Severity: normal CC: mono-bugs+mono
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:

Description Lewis Cheng 2014-05-28 05:05:15 UTC
Test case:

public class A {                                                                                                                                    
    public static bool TryAssign(out int x) {
       x = 0;
       return true;
    }
    public static void Main() {
       int x, y;
       if ((!TryAssign(out x) || x == 0) & (!TryAssign(out y) || y == 0)) {
       }
       return;
    }
}

Will report error CS0165: Use of unassigned local variable 'y'.

I guess the problem is with Binary.FlowAnalysis, where 'y == 0' gets the wrong DefiniteAssignment before line 2636 'right.FlowAnalysis(fc)'?

Thanks.
Comment 1 Marek Safar 2014-05-28 10:25:16 UTC
Fixe in master