From e453572b6ab9feeacd4fcbd660d954aec44c4777 Mon Sep 17 00:00:00 2001 From: Charles Pigott Date: Mon, 25 Mar 2019 22:45:32 +0000 Subject: [PATCH] Codechange: Initialise a few variables that -flto seems to think could possibly be uninitialised --- src/order_base.h | 2 +- src/strings.cpp | 3 ++- src/vehicle_cmd.cpp | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/order_base.h b/src/order_base.h index 0def7b0bcd..b11c20d8e6 100644 --- a/src/order_base.h +++ b/src/order_base.h @@ -50,7 +50,7 @@ private: public: Order *next; ///< Pointer to next order. If NULL, end of list - Order() : refit_cargo(CT_NO_REFIT), max_speed(UINT16_MAX) {} + Order() : flags(0), refit_cargo(CT_NO_REFIT), max_speed(UINT16_MAX) {} ~Order(); Order(uint32 packed); diff --git a/src/strings.cpp b/src/strings.cpp index 204c68c204..c3669e5dc5 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -118,7 +118,8 @@ void SetDParamMaxValue(uint n, uint64 max_value, uint min_count, FontSize size) */ void SetDParamMaxDigits(uint n, uint count, FontSize size) { - uint front, next; + uint front = 0; + uint next = 0; GetBroadestDigit(&front, &next, size); uint64 val = count > 1 ? front : next; for (; count > 1; count--) { diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp index 919173ac17..059f608379 100644 --- a/src/vehicle_cmd.cpp +++ b/src/vehicle_cmd.cpp @@ -131,7 +131,7 @@ CommandCost CmdBuildVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint DoCommandFlag subflags = flags; if (refitting) subflags |= DC_EXEC; - Vehicle *v; + Vehicle *v = NULL; switch (type) { case VEH_TRAIN: value.AddCost(CmdBuildRailVehicle(tile, subflags, e, GB(p1, 24, 8), &v)); break; case VEH_ROAD: value.AddCost(CmdBuildRoadVehicle(tile, subflags, e, GB(p1, 24, 8), &v)); break;