From 481eb6ae8018d0478c23fda7c5f9f3fa4db8de89 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Fri, 14 Nov 2014 03:53:51 -0500 Subject: arm: Fixes based on UBSan and static analysis Another churn to clean up undefined behaviour, mostly ARM, but some parts also touching the generic part of the code base. Most of the fixes are simply ensuring that proper intialisation. One of the more subtle changes is the return type of the sign-extension, which is changed to uint64_t. This is to avoid shifting negative values (undefined behaviour) in the ISA code. --- src/arch/arm/types.hh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/arch/arm/types.hh') diff --git a/src/arch/arm/types.hh b/src/arch/arm/types.hh index 14cce8294..cebbcef69 100644 --- a/src/arch/arm/types.hh +++ b/src/arch/arm/types.hh @@ -223,7 +223,8 @@ namespace ArmISA uint8_t _nextItstate; uint8_t _size; public: - PCState() : flags(0), nextFlags(0), _itstate(0), _nextItstate(0) + PCState() : flags(0), nextFlags(0), _itstate(0), _nextItstate(0), + _size(0) {} void @@ -233,7 +234,8 @@ namespace ArmISA npc(val + (thumb() ? 2 : 4)); } - PCState(Addr val) : flags(0), nextFlags(0), _itstate(0), _nextItstate(0) + PCState(Addr val) : flags(0), nextFlags(0), _itstate(0), + _nextItstate(0), _size(0) { set(val); } bool -- cgit v1.2.3