Crashes in Intel C++ Compiler, doesn't crash in Microsoft VS2005 C++ Compiler -- HELP!

jimdempseyatthecove
Total Points:
34,847
Status Points:
34,847
Black Belt
January 19, 2009 9:06 AM PST
Rate
 
#8 Reply to #7

>> The program should have crashed in the visual studio C++ compiler version as well, but it did not.

The correct statement is "The behavior of the program is undefined."
i.e.

a) it is not required to crash
b) it is not required to to be benign
c) it may trash something in your program that will not appear in testing
d) it may trash something in your program that will only appear at user site

I would suggest you perform a Find in Files for all occurences of "delete*[]"
Then for each, in seperate find window, locate all allocates to that pointer to check consistancy of use.

Then invert and find all allocates using [ and then for each check the delete.

PCLINT might be able to detect this (I don't use it, but I think it will detect this)

Using a container for the arrays can be helpful in eliminating this problem. If programmed correctly it will not add any computational overhead to the program (if may potentially for some vector optimizations).

Jim Dempsey



Intel Software Network Forums Statistics

8290 users have contributed to 31236 threads and 99111 posts to date.
In the past 24 hours, we have 7 new thread(s) 20 new posts(s), and 30 new user(s).

In the past 3 days, the most popular thread for everyone has been comparison cilk++, openmp, pthreads first results The most posts were made to comparison cilk++, openmp, pthreads first results The post with the most views is Very amusing...  Escalated as

Please welcome our newest member zq.x