Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Sanitizer help

david47
Novice
268 Views

Hi!

I am running Intel Fortran 2024.1 on Visual Studio 2022.  I would like to compile my code using the address sanitizer but am very confused as to how to do this.  I have read the previous posts here as well as the solutions but cannot seem to get it to work.  Could someone please point me to instructions on how to compile and link with the sanitizer?  I have  set Traceback  to Yes and "Check:all" for Runtime Error Checking" in the Run-Time tab under Fortran and have disabled Incremental Linking and asked for Full debugging.  I am using the IDX compiler and am in Debug x64.

Thank you so much for your help!

David

0 Kudos
3 Replies
Ron_Green
Moderator
249 Views

The address sanitizer is NOT part of -check all 

It has it's own compiler option, and to my knowledge is not yet integrated into the Properties pages.  You will have to add this option manually to the Options window in the properties. 

/fsanitize=address

 

https://www.intel.com/content/www/us/en/docs/fortran-compiler/developer-guide-reference/2025-0/fsanitize.html

 

Try this option.  I am suspicious in the syntax, I would have suspected the syntax to be /fsanitize:address to be more Windows-esque. 

 

I hope this helps.  Our documentation on Sanitizers leaves a lot to be desired.  

0 Kudos
Ron_Green
Moderator
249 Views

Also, the documentation should call out that sanitizers cause a performance degration.  Expect a 2x to 5x slower runtime when this santizer is enabled. Thus, not recommended for production code.

0 Kudos
david47
Novice
219 Views

Hi Ron!

Thank you for your reply however it is still not working.  I did however follow the link you sent and read that the sanitizer can only detect memory leaks in Linux, not Windows.  Is this correct or has things changed since it was first written?  I wrote a small test code where I allocated memory of a junk array, indexed it 1 greater that the space allocated and then deallocated it twice!  During the run, this error was caught but not with any ASAN remarks?

I also ran my code outside of Visual Studio, in a VS cmd window.  I have turned traceback off and error checking to none.  I also added the /fsanitize=address to the Command Line in Fortran and Linker.

 

Am I missing something else?

 

Thank you so much again!  I really appreciate all of the help

 

Sincerely,

David

 

0 Kudos
Reply