When I compile the following program:
strcpy(x, "mumbo jumbo");
len = (int) strlen(x);
with icc 11.1 and optimization level -O2 or higher, valgrind complains about numerous runtime errors, most probably initially triggered triggered
inside strlen(). If, however, I compile it with '-nolib-inline', all error messages are gone.
Besides, compiling with icc 10.1 or 11.0 also gives no errors.
I hope that helps,
thanks for the quick reply. The submitted example is a close to minimal test case.
icc tstr.c -g -O2
valgrind ./a.out | & less
valgrind versio is 3.3.0, flags enabled by default are: -v --trace-children=yes --time-stamp=yes --error-limit=no --leak-check=full
Looks like this is a known limitation of valgrind. See http://valgrind.org/docs/manual/dist.news.html under Known Limitations:
- Memcheck is unusable with the Intel compiler suite version 11.1, when it generates code for SSE2-and-above capable targets. This is because of icc's use of highly optimised inlined strlen implementations. It causes Memcheck to report huge numbers of false errors even in simple programs. Helgrind and DRD may also have problems.
If you're using the compiler for 32-bit, you can use the -mia32 option to workaround this, but this optionwill likely impact your performance.
This was actually a deficiency in Valgrind; it gets confused by aligned vector loads that extend past the end of an allocated memory block.
This deficiency is fixed in (soon-to-be-released) Valgrind 3.9.0 and above. If you use that version of Valgrind and run your test case with "--partial-loads-ok=yes", you should find it works now.