Skip to content

Commit be01998

Browse files
committed
Do not set the uASSIGNED flag for global variables
1 parent 3a474a1 commit be01998

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

source/compiler/sc2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3215,7 +3215,7 @@ SC_FUNC void markinitialized(symbol *sym,int assignment)
32153215
return;
32163216
if (sc_status==statFIRST && (sym->vclass==sLOCAL || sym->vclass==sSTATIC))
32173217
return;
3218-
if (assignment && (sym->ident==iVARIABLE || sym->ident==iREFERENCE)) {
3218+
if (assignment && sym->vclass!=sGLOBAL && (sym->ident==iVARIABLE || sym->ident==iREFERENCE)) {
32193219
sym->usage |= uASSIGNED;
32203220
sym->assignlevel=pc_nestlevel;
32213221
} /* if */

source/compiler/tests/warning_240.pwn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ test_locals()
153153

154154
test_globals()
155155
{
156-
// Assignments to global variables are not tracked (yet?)
156+
// Assignments to global variables are not tracked
157157
global_var = 1;
158158
global_var = 2;
159159
UseVariable(global_var);

0 commit comments

Comments
 (0)