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

Submitted by:  None
Submitted on:  Wed 28 Jan 2004 01:00:07 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned 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>
Project 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>
Project 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

 

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

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follow 2 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Sun 05 Jun 2005 08:25:48 AM UTCdrobossonAttached File-=>Added testcase.c, #2574
Wed 28 Jan 2004 01:00:07 AM UTCNoneAttached File-=>Added for_loop_test.cs, #1007

Back to the top


Powered by Savane 3.1-cleanup1