From 47661b746bc07be92c0204e8db7fe7fdb9f14c4b Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sat, 3 Feb 2018 03:04:44 +0000 Subject: [PATCH] basic_block: Fix bogus GCC maybe-uninitialized warning --- src/frontend/ir/basic_block.cpp | 2 +- src/frontend/ir/basic_block.h | 2 +- tests/A64/fuzz_with_unicorn.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/frontend/ir/basic_block.cpp b/src/frontend/ir/basic_block.cpp index 9ac5ee9c..96bc7dd2 100644 --- a/src/frontend/ir/basic_block.cpp +++ b/src/frontend/ir/basic_block.cpp @@ -84,7 +84,7 @@ const Block::InstructionList& Block::Instructions() const { return instructions; } -const Terminal& Block::GetTerminal() const { +Terminal Block::GetTerminal() const { return terminal; } diff --git a/src/frontend/ir/basic_block.h b/src/frontend/ir/basic_block.h index 6d4953db..40a404d7 100644 --- a/src/frontend/ir/basic_block.h +++ b/src/frontend/ir/basic_block.h @@ -118,7 +118,7 @@ public: const InstructionList& Instructions() const; /// Gets the terminal instruction for this basic block. - const Terminal& GetTerminal() const; + Terminal GetTerminal() const; /// Sets the terminal instruction for this basic block. void SetTerminal(Terminal term); /// Replaces the terminal instruction for this basic block. diff --git a/tests/A64/fuzz_with_unicorn.cpp b/tests/A64/fuzz_with_unicorn.cpp index 812cb3d4..5ed54109 100644 --- a/tests/A64/fuzz_with_unicorn.cpp +++ b/tests/A64/fuzz_with_unicorn.cpp @@ -66,7 +66,7 @@ restart: bool should_continue = A64::TranslateSingleInstruction(block, location, instruction); if (!should_continue && !is_last_inst) goto restart; - if (!should_continue && boost::get(&block.GetTerminal())) + if (auto terminal = block.GetTerminal(); boost::get(&terminal)) goto restart; for (const auto& ir_inst : block) if (ir_inst.GetOpcode() == IR::Opcode::A64ExceptionRaised || ir_inst.GetOpcode() == IR::Opcode::A64CallSupervisor)