Browse Source

Fixed uninitialized static local

Brian Fiete 3 years ago
parent
commit
0d5b209a14
1 changed files with 3 additions and 0 deletions
  1. 3 0
      IDEHelper/Compiler/BfStmtEvaluator.cpp

+ 3 - 0
IDEHelper/Compiler/BfStmtEvaluator.cpp

@@ -1823,6 +1823,9 @@ BfLocalVariable* BfModule::HandleVariableDeclaration(BfVariableDeclaration* varD
 			initValue = BfTypedValue();
 		}
 
+		if (!initValue)
+			initValue = GetDefaultTypedValue(localDef->mResolvedType);
+
 		localDef->mAddr = mBfIRBuilder->CreateGlobalVariable(mBfIRBuilder->MapType(localDef->mResolvedType), false, BfIRLinkageType_Internal, initValue.mValue, name);;
 		initHandled = true;
 	}