[Mono-bugs] [Bug 24509] New - Uninitialized variable not found by mcs
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
10 May 2002 13:25:56 -0000
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by detlev@die-offenbachs.de.
http://bugzilla.ximian.com/show_bug.cgi?id=24509
--- shadow/24509 Fri May 10 09:25:56 2002
+++ shadow/24509.tmp.16701 Fri May 10 09:25:56 2002
@@ -0,0 +1,39 @@
+Bug#: 24509
+Product: Mono/MCS
+Version: unspecified
+OS: other
+OS Details: SuSE 8.0
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: detlev@die-offenbachs.de
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Uninitialized variable not found by mcs
+
+The attached example taken from
+"Programming C#" does not produce a compiler errormessage saying that the
+variable myInt is used uninitialized. It compiles cleanly instead (used
+mcs v0.11). Furthermore the uninitialized variable was not implicitly
+initialized to 0 (as good C and C++ compilers do). I don't know, if this
+is in error as well. The output from the run was
+
+Uninitialized, myInt: -1073746096
+After assignment, myInt: 5
+
+The code is as follows:
+
+class Values {
+
+ static void Main() {
+ int myInt;
+ System.Console.WriteLine("Uninitialized, myInt: {0}", myInt);
+ myInt = 5;
+ System.Console.WriteLine("After assignment, myInt: {0}", myInt);
+ }
+}