Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*
770 Discussions

icx address sanitizer on Windows and program with C++ exeptions crash

Frank_R_1
New Contributor I
423 Views

Hi,


Unfortunately in Intel oneAPI 2024.2 with Windows 10/VS 2019 the reproducer below does not work!
see
https://community.intel.com/t5/Intel-oneAPI-DPC-C-Compiler/icx-with-enabled-address-sanitizer-under-Windows-and-C-throw/m-p/1614289#M3941

#############################################################

//icx -Od -EHsc -Z7 ex.cxx
//works with output "Caught error no. 5 exception at ex.cxx in line 15"

//icx -Od -fsanitize=address -EHsc -Z7 ex.cxx
//crashes with "Caught error no. Segmentation fault"
#include<iostream>
struct Error {
int a;
};
void info(const char* f, const int l, const Error& e) {
std::cout << "Caught error no. " << e.a << " exception at " << f << " in line " << l << std::endl;
}
int main() {
try {
throw Error{5};
} catch (Error &e) {
info(__FILE__, __LINE__, e);
return 0;
}
return 1;
}

#############################################################

Everything on Linux now works very nice and stable, the exact same code base on Windows crashes in the exceptions catch. (Have a look in the debugger)

ASAN_OPTIONS are:
alloc_dealloc_mismatch=0,detect_leaks=0,halt_on_error=0,detect_stack_use_after_return=true,check_initialization_order=true,strict_string_checks=true,check_malloc_usable_size=true,detect_odr_violation=1,strict_init_order=1,use_odr_indicator=1,handle_segv=0


Best regards

Frank

0 Kudos
1 Reply
Alex_Y_Intel
Moderator
365 Views

I've escalated your issue to our engineering team so we can investigate further. 

0 Kudos
Reply