[DeviceASAN] Fix missing initialization of address-space-specific callbacks (#37091)
[DeviceASAN] Fix missing initialization of address-space-specific
callbacks
The AsanMemoryAccessCallbackAS and AsanMemoryAccessCallbackSizedAS
arrays
were declared but never initialized, causing a segmentation fault when
compiling SYCL device code with -fsanitize=address. The arrays are used
in instrumentAddress() and instrumentUnusualSizeOrAlignment() for
SPIR/SPIRV
targets to generate address-space-specific ASAN runtime calls.
This initialization was originally present in commit 644a7631b27c but
was
lost during conflict resolution in commit 05f00a7b6090 when the code was
refactored to use the new Inserter.insertFunction() API. The
SPIR-specific
initialization block was moved outside the main loop, but the callback
array initialization was accidentally omitted.
This commit recovers the original logic by restoring the SPIR-specific
initialization inside the main loop (where it was in 644a7631b27c),
adapted
to use the new Inserter API. The fix:
- Adds debug info parameters (file, line, func) to Args1/Args2 for SPIR
targets
- Initializes AsanMemoryAccessCallbackAS for all access sizes and
address spaces
- Initializes AsanMemoryAccessCallbackSizedAS for all address spaces
- Uses continue to skip non-SPIR callback initialization
Test: Compilation of sycl/test-e2e/Adapters/retain_events.cpp with
-Xarch_device -fsanitize=address no longer crashes.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
https://jira.devtools.intel.com/browse/CMPLRLLVM-75779
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>