Skip to content

Commit

Permalink
Pass -fno-sanitize-trap=undefined in debug mode
Browse files Browse the repository at this point in the history
This should undo the effect of `-fsanitize-trap` that zig cc is passing internally.

See ziglang/zig#5163 (comment)
  • Loading branch information
avdv committed May 6, 2024
1 parent 497c395 commit 13e129b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
- name: Cross Compile
run: nix develop --ignore-environment --keep HOME --keep SCALANATIVE_MODE --command '.github/crosscompile'
env:
SCALANATIVE_MODE: ${{ github.ref == 'refs/heads/main' && 'release-full' || 'release-fast' }}
SCALANATIVE_MODE: ${{ github.ref == 'refs/heads/main' && 'release-full' || 'debug' }}
- name: qemu-aarch64 scalals
run: nix shell 'nixpkgs#qemu' --command qemu-aarch64 scalals-out-linux-aarch64
- uses: actions/upload-artifact@v4
Expand Down
3 changes: 2 additions & 1 deletion project/Ninja.scala
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,8 @@ object Ninja extends AutoPlugin {

private def opt(config: Config): Seq[String] =
config.mode match {
case Mode.Debug => List("-O0")
// disable trap mode for UB sanitizer in debug mode
case Mode.Debug => List("-O0", "-fno-sanitize-trap=undefined")
case Mode.ReleaseFast => List("-O2", "-Xclang", "-O2")
case Mode.ReleaseFull => List("-O3", "-Xclang", "-Ofast")
case Mode.ReleaseSize => List("-Os", "-Xclang", "-Oz")
Expand Down

0 comments on commit 13e129b

Please sign in to comment.