bugDotGNU Portable.NET - Bugs: bug #7485, Non-initialized variable in...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #7485: Non-initialized variable in for-loop shall not be compiled by cscc

Submitter:  None
Submitted:  Wed 28 Jan 2004 01:00:07 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open

Sun 05 Jun 2005 08:25:48 AM UTC, comment #2: 

Digging a bit further, this doesn't appear to be tied directly to the FOR keyword and related parsing.  It can occur elsewhere as well as demonstrated in the attached test case.

ExpressionStatementList->ExpressionStatement->InnerExpressionStatement->AssignmentExpression would be the flow I would expect to happen in this circumstance for the CS case.  The first entry for AssignmentExpression is '=' though I can only assume what $1 and $3 should be (variable and value?) as passed to MakeBinary.  Klaus suggested during the course of conversation, "the first case in AssignmentExpression should set a kind of flag on the variable that it is initialized".

Rhys, can you offer any ideas or suggestions on this?

Deryk Robosson <drobosson>
Group Member
Fri 18 Mar 2005 04:11:32 PM UTC, comment #1: 

Able to reproduce using test case.

Further information for this can be found in the ECMA 334 spec 8.3 from which states, "A variable must be assigned before its value can be obtained.".

Deryk Robosson <drobosson>
Group Member
Wed 28 Jan 2004 01:00:07 AM UTC, original submission:  

Compiling the attached demo file containing a for-loop with a  variable, that isn't initialized, stops using Billy's csc with an error message as follows:

error CS0165: Use of unassigned variable 'i'

Compiling it with cscc doesn't produce this error. The file compiles and runs with no errors in dotgnu.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #3040:  testcase.c added by drobosson (74B - application/octet-stream - Additional C test case)
file #1027:  for_loop_test.cs added by None (166B - application/octet-stream - Demo file)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

 

Follow 2 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-06-05 drobosson Attached File- Added testcase.c, #2574
2004-01-28 None Attached File- Added for_loop_test.cs, #1007

Back to the top

Powered by Savane 3.13-758e.
Corresponding source code