2
0
Эх сурвалжийг харах

Fixed uninitialized static local

Brian Fiete 3 жил өмнө
parent
commit
0d5b209a14

+ 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;
 	}