From eea68581218a8e389180d59b078e9d9dc54eb8c8 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 22 Mar 2018 21:58:42 -0400 Subject: [PATCH] Resolves undefined behaviour from uninitialised limited-range values. --- Analyser/Static/Acorn/Target.hpp | 6 +++--- Analyser/Static/AmstradCPC/Target.hpp | 2 +- Analyser/Static/Atari/Target.hpp | 4 ++-- Analyser/Static/Commodore/Target.hpp | 4 ++-- Analyser/Static/Oric/Target.hpp | 4 ++-- Analyser/Static/ZX8081/Target.hpp | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Analyser/Static/Acorn/Target.hpp b/Analyser/Static/Acorn/Target.hpp index e247f7bfc..c2f9f22b4 100644 --- a/Analyser/Static/Acorn/Target.hpp +++ b/Analyser/Static/Acorn/Target.hpp @@ -16,9 +16,9 @@ namespace Static { namespace Acorn { struct Target: public ::Analyser::Static::Target { - bool has_adfs; - bool has_dfs; - bool should_shift_restart; + bool has_adfs = false; + bool has_dfs = false; + bool should_shift_restart = false; }; } diff --git a/Analyser/Static/AmstradCPC/Target.hpp b/Analyser/Static/AmstradCPC/Target.hpp index 056c45402..795106435 100644 --- a/Analyser/Static/AmstradCPC/Target.hpp +++ b/Analyser/Static/AmstradCPC/Target.hpp @@ -22,7 +22,7 @@ struct Target: public ::Analyser::Static::Target { CPC6128 }; - Model model; + Model model = Model::CPC464; }; } diff --git a/Analyser/Static/Atari/Target.hpp b/Analyser/Static/Atari/Target.hpp index dc6cd7955..9f0119ada 100644 --- a/Analyser/Static/Atari/Target.hpp +++ b/Analyser/Static/Atari/Target.hpp @@ -32,8 +32,8 @@ struct Target: public ::Analyser::Static::Target { }; // TODO: shouldn't these be properties of the cartridge? - PagingModel paging_model; - bool uses_superchip; + PagingModel paging_model = PagingModel::None; + bool uses_superchip = false; }; } diff --git a/Analyser/Static/Commodore/Target.hpp b/Analyser/Static/Commodore/Target.hpp index 381e35207..b40d0a1f0 100644 --- a/Analyser/Static/Commodore/Target.hpp +++ b/Analyser/Static/Commodore/Target.hpp @@ -22,8 +22,8 @@ struct Target: public ::Analyser::Static::Target { ThirtyTwoKB }; - MemoryModel memory_model; - bool has_c1540; + MemoryModel memory_model = MemoryModel::Unexpanded; + bool has_c1540 = false; }; } diff --git a/Analyser/Static/Oric/Target.hpp b/Analyser/Static/Oric/Target.hpp index b3a507de2..f920d7e5a 100644 --- a/Analyser/Static/Oric/Target.hpp +++ b/Analyser/Static/Oric/Target.hpp @@ -14,8 +14,8 @@ namespace Static { namespace Oric { struct Target: public ::Analyser::Static::Target { - bool use_atmos_rom; - bool has_microdisc; + bool use_atmos_rom = false; + bool has_microdisc = false; }; } diff --git a/Analyser/Static/ZX8081/Target.hpp b/Analyser/Static/ZX8081/Target.hpp index 180282576..7fef01e08 100644 --- a/Analyser/Static/ZX8081/Target.hpp +++ b/Analyser/Static/ZX8081/Target.hpp @@ -22,8 +22,8 @@ struct Target: public ::Analyser::Static::Target { SixtyFourKB }; - MemoryModel memory_model; - bool isZX81; + MemoryModel memory_model = MemoryModel::Unexpanded; + bool isZX81 = false; }; }