From 049489c85b490fd1f03e87f3f295821016bc0981 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Sat, 27 Feb 2021 10:38:04 -0800 Subject: [PATCH] Fix a small regression impacting MSVC debug builds (#285) * decomp: Fix nonempty_intersection impl for MSVC Debugging use-case * docs: Add info on getting ASan builds running on Visual Studio w/o exceptions --- README.md | 8 ++++++++ decompiler/IR2/FormStack.cpp | 12 +++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 616429a370..3b2a5174ad 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,14 @@ - [Table of Contents](#table-of-contents) - [Project Description](#project-description) - [Getting Started - Linux (Ubuntu)](#getting-started---linux-ubuntu) +- [Getting Started - Linux (Arch)](#getting-started---linux-arch) +- [Getting Started - Nixpkgs](#getting-started---nixpkgs) - [Getting Started - Windows](#getting-started---windows) - [Project Layout](#project-layout) - [Directory Layout](#directory-layout) - [More Documentation](#more-documentation) - [ASan Build](#asan-build) + - [On Windows / Visual Studio](#on-windows--visual-studio) ## Project Description @@ -236,3 +239,8 @@ You will have to delete the build folder when changing compilers. When running ``` Then you can run the tests, runtime, and compiler as normal and they will abort if ASan finds an error. + +### On Windows / Visual Studio + +Until 16.9 Preview 4, when attaching a debugger to the ASan build, you must disable breaking on Win32 Access Violation exceptions. See the relevant section `Debugging - Exceptions` here https://devblogs.microsoft.com/cppblog/asan-for-windows-x64-and-debug-build-support/#known-issues + diff --git a/decompiler/IR2/FormStack.cpp b/decompiler/IR2/FormStack.cpp index 37a93eca6a..ff1674a35f 100644 --- a/decompiler/IR2/FormStack.cpp +++ b/decompiler/IR2/FormStack.cpp @@ -110,10 +110,12 @@ Form* FormStack::pop_reg(const Variable& var, namespace { bool nonempty_intersection(const RegSet& a, const RegSet& b) { - // todo - if we ever switch to bit reg sets, this could be a lot faster. - std::vector isect; - std::set_intersection(a.begin(), a.end(), b.begin(), b.end(), std::back_inserter(isect)); - return !isect.empty(); + for (auto x : a) { + if (b.find(x) != b.end()) { + return true; + } + } + return false; } } // namespace @@ -378,4 +380,4 @@ std::vector rewrite_to_get_var(FormStack& stack, return default_result; } -} // namespace decompiler \ No newline at end of file +} // namespace decompiler