GithubHelp home page GithubHelp logo

MSVC sanitizers about cnl HOT 2 CLOSED

johnmcfarlane avatar johnmcfarlane commented on June 12, 2024
MSVC sanitizers

from cnl.

Comments (2)

johnmcfarlane avatar johnmcfarlane commented on June 12, 2024

MSVC sanitizers are not ready.

ASanitizer is of little use in a statically-sized numbers library anyway. Also, it doesn't appear to run reliably.
UBSan doesn't exist yet.
A few checks are available using the /RTC flags but they are not unit-test friendly. They could be enabled with

diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index dd8550ae..f3774f6d 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -298,8 +298,11 @@ jobs:
       - name: Install dependencies
         working-directory: ${{runner.workspace}}/build
         run: |
+          $sanitize = ("${{matrix.build_type}}" -eq "Debug")
+          echo $sanitize
           conan install `
             --build=missing `
+            --options sanitize=$sanitize `
             --profile:build $env:GITHUB_WORKSPACE/.github/conan/profiles/${{matrix.build-profile}} `
             --profile:host $env:GITHUB_WORKSPACE/.github/conan/profiles/${{matrix.host-profile}} `
             --settings:build build_type=Release `
diff --git a/test/toolchain/msvc.cmake b/test/toolchain/msvc.cmake
index 2dd2bc66..73b398aa 100644
--- a/test/toolchain/msvc.cmake
+++ b/test/toolchain/msvc.cmake
@@ -6,4 +6,6 @@ set(EXCEPTION_DISABLED_FLAGS "/GR- -DBOOST_NO_EXCEPTIONS -DBOOST_NO_RTTI")
 set(INT128_ENABLED_FLAGS "")
 set(INT128_DISABLED_FLAGS "")
 
+set(SANITIZE_ENABLED_CXX_FLAGS "/RTCcsu -D_ALLOW_RTCc_IN_STL")
+
 set(SAMPLE_CXX_FLAGS "/wd4018")

but this triggers dialogues inside tests designed to illustrate UB or test that sanitizers trap.

from cnl.

johnmcfarlane avatar johnmcfarlane commented on June 12, 2024

AddressSanitizer changes (as far as I got):

diff --git a/test/toolchain/msvc.cmake b/test/toolchain/msvc.cmake
index 2dd2bc66..12050502 100644
--- a/test/toolchain/msvc.cmake
+++ b/test/toolchain/msvc.cmake
@@ -6,4 +6,7 @@ set(EXCEPTION_DISABLED_FLAGS "/GR- -DBOOST_NO_EXCEPTIONS -DBOOST_NO_RTTI")
 set(INT128_ENABLED_FLAGS "")
 set(INT128_DISABLED_FLAGS "")
 
+set(SANITIZE_ENABLED_CXX_FLAGS "/fsanitize=address /fsanitize-address-use-after-return /INCREMENTAL:NO /Zi")
+set(SANITIZE_ENABLED_LINKER_FLAGS "/DEBUG")
+
 set(SAMPLE_CXX_FLAGS "/wd4018")

from cnl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.