Explorar o código

Fixed uninitialized static local

Brian Fiete %!s(int64=3) %!d(string=hai) anos
pai
achega
0d5b209a14
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      IDEHelper/Compiler/BfStmtEvaluator.cpp

+ 3 - 0
IDEHelper/Compiler/BfStmtEvaluator.cpp

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