[Mono-bugs] [Bug 666403] False positives in EnsureLocalDisposeRule

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Jan 22 21:12:42 EST 2011



Sebastien Pouliot <spouliot at novell.com> changed:

           What    |Removed                     |Added
                 CC|                            |spouliot at novell.com

--- Comment #1 from Sebastien Pouliot <spouliot at novell.com> 2011-01-23 02:12:41 UTC ---
Good test cases :)

+        StreamReader Success9 ()
+        {
+            return new StreamReader ("baz.xml"); //return value
+        }

That will not report a defect. However I do not like the current optimization
(it's too general, i.e. there could be other locals not disposed).

+        bool Success10 (out StreamReader stream)
+        {
+            var new_stream = new StreamReader ("baz.xml"); //out param
+            stream = new_stream;
+            return true;
+        }

That would work if coded like this:

+            var stream = new StreamReader ("baz.xml"); //out param
+            return true;

since it avoids a local. Right now the code depends on 'Instruction' instead of
'VariableDefinition' which makes tracking locals against several condition
(e.g. the 'ref' use) impossible.

The 3rd case is similar (it works when eliminating the variable). Again
tracking this requires tracking VariableDefinition instead of Instruction.

Sadly it's a bit of a big change, too big to backport to 2-10 so it will need
to wait for v.next. But I'll commit this (and the variations) to master soon.

Keeping this open until resolved.

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list