Static Analysis and Run Time Error Detection on 64-Bit Platforms

Posted on Oct 14, 2010

64-bit error detectionIn my previous posts, I covered a four-step strategy for preparing the application for the 64-bit porting process:

  1. Apply mutation testing to perform run time error detection
  2. Use static code analysis to identify error-prone and non-portable code
  3. Repeat run time error detection
  4. Perform unit testing (Optional)
To wrap up this topic, I'd like to introduce a strategy for identifying defects on the 64-bit processor:

  1. Recompile the code on the 64-bit processor
  2. Repeat static analysis code inspection
  3. Link and build
  4. Get the application running
  5. Repeat runtime error detection

Step 1: Recompile the code on the 64-bit processor

Recompile your application on the 64-bit processor. If you have trouble compiling it, work out all of the quirks related to compiler variations. You might also want to create static code analysisrules that will automatically identify the code associated with these quirks so that you can prevent these compilation problems from occurring in the future.

Step 2: Repeat static analysis code inspection

Once you recompile the code, perform static code analysis again to check if the new code complies with all appropriate coding standards. At this point, every change that should have been made but that was not made is an error. Fix these errors immediately! You don’t want to look for these errors as the application is running.

Step 3: Link and build

Link your application and try to build it.

Step 4: Get the application running

At this point, you should try to run your code. If you have a problem getting code running on the 64-bit processor, use a unit testing framework to run the code function by function; that way, you can flush exactly what in the code is not portable. Test the function, and then fix the problem. Continue this process until the entire application is running.

Step 5: Repeat run time error detection

Once the application is running, you’ll want to repeat run time error detection because the porting process is likely to cause some new problems that could not be detected before the port (for example, new memory corruption problems or different behaviors). If the run time error detection exposes problems, fix every bug related to porting.

***
Photo Credit: jurvetson

Want to learn more? View our on-demand webinar Expose Hidden C and C++ Defects Automatically to learn how you can use Parasoft Insure++'s runtime error detection to expose memory corruption, memory leaks, access outside of array bounds, invalid pointers, and other defects.

ctbook-cta.jpg