Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
7746 Discussions

Compiler flag to turn off null check of this optimization

battlegoat
Beginner
110 Views

I posted this question yesterday with some example compiler flags but the message got flagged as spam (to many dashes and slashes?) so I will more carefully word my question today.  (PS it may be wise not to flag messages with lots of dashes as spam in a compiler support forum!)

 

The latest oneapi c++ compiler will now optimize out a check of "this" being nullptr in a class member.  This is likely following gcc and the language standard which indicates that a call to a member should never be done on nullptr.  However legacy code can often use this check of "this == nullptr" to catch such calls.

Previous Intel C++ and current MS VS C++ do not automatically remove this test in optimization. gcc has a flag (add dashes) "no delete null pointer checks" to turn off this optimization.  

What is the flag to use for Intel C++ to turn off this optimization?

0 Kudos
0 Replies
Reply