From ec935330d4518829d01bbdf5670c4569fa07a567 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Mon, 15 Dec 2025 22:15:09 +0100 Subject: Allow constants in asan:reserve statements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This way, if you define a constant like: MY_BUFFER_LEN_IN_BYTES = $10 You can then declare your buffer like so: zp_buffer = $00 ; asan:reserve MY_BUFFER_LEN_IN_BYTES And then further in the code you can rely on just using the constant for bound checking, and then the address sanitizer will check on bound checks via static analysis as well. Signed-off-by: Miquel Sabaté Solà --- tests/expected/asan_reserve_constant.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/expected/asan_reserve_constant.txt (limited to 'tests/expected') diff --git a/tests/expected/asan_reserve_constant.txt b/tests/expected/asan_reserve_constant.txt new file mode 100644 index 0000000..e08f84f --- /dev/null +++ b/tests/expected/asan_reserve_constant.txt @@ -0,0 +1 @@ +error: The variable 'zp_another' ($01) conflicts with 'zp_var' ($00-$01) (asan_reserve_constant.s) -- cgit v1.2.3