Skip to content

Commit 6eeb215

Browse files
authored
chore: CI: enable leak sanitizer again (#11339)
1 parent 16740a1 commit 6eeb215

File tree

10 files changed

+24
-21
lines changed

10 files changed

+24
-21
lines changed

.github/workflows/build-template.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ jobs:
4646
CCACHE_MAXSIZE: 400M
4747
# squelch error message about missing nixpkgs channel
4848
NIX_BUILD_SHELL: bash
49-
# TODO
50-
ASAN_OPTIONS: detect_leaks=0
5149
LSAN_OPTIONS: max_leaks=10
5250
# somehow MinGW clang64 (or cmake?) defaults to `g++` even though it doesn't exist
5351
CXX: c++

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ jobs:
153153
# 0: PRs without special label
154154
# 1: PRs with `merge-ci` label, merge queue checks, master commits
155155
# 2: nightlies
156-
# 2: PRs with `release-ci` label, full releases
156+
# 3: PRs with `release-ci` label, full releases
157157
- name: Set check level
158158
id: set-level
159159
# We do not use github.event.pull_request.labels.*.name here because
@@ -259,15 +259,15 @@ jobs:
259259
},
260260
{
261261
"name": "Linux fsanitize",
262-
"os": "ubuntu-latest",
262+
// Always run on large if available, more reliable regarding timeouts
263+
"os": large ? "nscloud-ubuntu-22.04-amd64-8x16-with-cache" : "ubuntu-latest",
263264
"enabled": level >= 2,
264-
// do not have nightly release wait for this
265-
"secondary": level <= 2,
266265
"test": true,
267266
// turn off custom allocator & symbolic functions to make LSAN do its magic
268267
"CMAKE_PRESET": "sanitize",
269-
// exclude seriously slow/problematic tests (laketests crash, async_base_functions timeouts)
270-
"CTEST_OPTIONS": "-E '(interactive|pkg|lake|bench)/|treemap|StackOverflow|async_base_functions'"
268+
// `StackOverflow*` correctly triggers ubsan
269+
// `reverse-ffi` fails to link in sanitizers
270+
"CTEST_OPTIONS": "-E 'StackOverflow|reverse-ffi'"
271271
},
272272
{
273273
"name": "macOS",

CMakePresets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"SMALL_ALLOCATOR": "OFF",
4242
"USE_MIMALLOC": "OFF",
4343
"BSYMBOLIC": "OFF",
44-
"LEAN_TEST_VARS": "MAIN_STACK_SIZE=16000 ASAN_OPTIONS=detect_leaks=0"
44+
"LEAN_TEST_VARS": "MAIN_STACK_SIZE=16000 LSAN_OPTIONS=max_leaks=10"
4545
},
4646
"generator": "Unix Makefiles",
4747
"binaryDir": "${sourceDir}/build/sanitize"

src/Lean/Compiler/IR/Boxing.lean

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ Assumptions:
2626
`Expr.isShared`, `Expr.isTaggedPtr`, and `FnBody.set`.
2727
-/
2828

29-
def mkBoxedName (n : Name) : Name :=
30-
Name.mkStr n "_boxed"
31-
32-
def isBoxedName (name : Name) : Bool :=
33-
name matches .str _ "_boxed"
34-
3529
abbrev N := StateM Nat
3630

3731
private def N.mkFresh : N VarId :=

src/Lean/Compiler/IR/CompilerM.lean

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,20 @@ def findEnvDecl (env : Environment) (declName : Name) (includeServer := false):
139139
private def findInterpDecl (env : Environment) (declName : Name) : Option Decl :=
140140
findEnvDecl (includeServer := true) env declName
141141

142+
namespace ExplicitBoxing
143+
144+
def mkBoxedName (n : Name) : Name :=
145+
Name.mkStr n "_boxed"
146+
147+
def isBoxedName (name : Name) : Bool :=
148+
name matches .str _ "_boxed"
149+
150+
end ExplicitBoxing
151+
142152
/-- Like ``findInterpDecl env (declName ++ `_boxed)`` but with optimized negative lookup. -/
143153
@[export lean_ir_find_env_decl_boxed]
144154
private def findInterpDeclBoxed (env : Environment) (declName : Name) : Option Decl :=
145-
let boxed := declName ++ `_boxed
155+
let boxed := ExplicitBoxing.mkBoxedName declName
146156
-- Important: get module index of base name, not boxed version. Usually the interpreter never
147157
-- does negative lookups except in the case of `call_boxed` which must check whether a boxed
148158
-- version exists. If `declName` exists as an imported declaration but `declName'` doesn't, the

src/Lean/Environment.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1718,7 +1718,7 @@ passing (a prefix of) the file names to `readModuleDataParts`. `mod` is used to
17181718
arbitrary but deterministic base address for `mmap`.
17191719
-/
17201720
@[extern "lean_save_module_data_parts"]
1721-
opaque saveModuleDataParts (mod : @& Name) (parts : Array (System.FilePath × ModuleData)) : IO Unit
1721+
opaque saveModuleDataParts (mod : @& Name) (parts : @& Array (System.FilePath × ModuleData)) : IO Unit
17221722

17231723
/--
17241724
Loads the module data from the given file names. The files must be (a prefix of) the result of a

src/Std/Data/ByteSlice.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def toByteArray (s : ByteSlice) : ByteArray :=
182182
Comparison function
183183
-/
184184
@[extern "lean_byteslice_beq"]
185-
protected def beq (a b : ByteSlice) : Bool :=
185+
protected def beq (a b : @& ByteSlice) : Bool :=
186186
a.toByteArray == b.toByteArray
187187

188188
instance : BEq ByteSlice := ⟨ByteSlice.beq⟩

src/Std/Internal/UV/System.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ opaque cwd : IO String
138138
Changes the current working directory.
139139
-/
140140
@[extern "lean_uv_chdir"]
141-
opaque chdir : String → IO Unit
141+
opaque chdir : @& String → IO Unit
142142

143143
/--
144144
Gets the path to the current user's home directory.

src/kernel/environment.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extern "C" object* lean_kernel_set_diag(object*, object*);
2828
extern "C" uint8* lean_kernel_diag_is_enabled(object*);
2929

3030
void diagnostics::record_unfold(name const & decl_name) {
31-
m_obj = lean_kernel_record_unfold(to_obj_arg(), decl_name.to_obj_arg());
31+
m_obj = lean_kernel_record_unfold(m_obj, decl_name.to_obj_arg());
3232
}
3333

3434
scoped_diagnostics::scoped_diagnostics(environment const & env, bool collect) {

src/library/ir_interpreter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ string_ref get_symbol_stem(elab_environment const & env, name const & fn) {
216216

217217
extern "C" object * lean_ir_format_fn_body_head(object * b);
218218
std::string format_fn_body_head(fn_body const & b) {
219-
return string_to_std(lean_ir_format_fn_body_head(b.to_obj_arg()));
219+
object_ref s(lean_ir_format_fn_body_head(b.to_obj_arg()));
220+
return string_to_std(s.raw());
220221
}
221222

222223
static bool type_is_scalar(type t) {

0 commit comments

Comments
 (0)