Possible bug in inlined string functions of icc Version 11.1 (Build 20090511 Package ID: l_cproc_p_11.1.038)

Possible bug in inlined string functions of icc Version 11.1 (Build 20090511 Package ID: l_cproc_p_11.1.038)

Hi all,
When I compile the following program:

#include
#include

int main()
{
char x[100];
int len;

strcpy(x, "mumbo jumbo");
len = (int) strlen(x);
printf("%d\n", len);
return 0;
}

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,
greetings,
Andreas

5 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

Quoting - wolfgang-svrcek-seiler
Hi all,
When I compile the following program:

#include
#include

int main()
{
char x[100];
int len;

strcpy(x, "mumbo jumbo");
len = (int) strlen(x);
printf("%dn", len);
return 0;
}

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,
greetings,
Andreas

I'll take a look at this. What command line are you using for valgrind?

Brandon Hewitt Technical Consulting Engineer For 1:1 technical support: http://premier.intel.com Software Product Support info: http://www.intel.com/software/support

Hi,
thanks for the quick reply. The submitted example is a close to minimal test case.
Command lines:
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
--leak-resolution=high

best,
Andreas

Quoting - wolfgang-svrcek-seiler
Hi,
thanks for the quick reply. The submitted example is a close to minimal test case.
Command lines:
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
--leak-resolution=high

best,
Andreas

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.

Brandon Hewitt Technical Consulting Engineer For 1:1 technical support: http://premier.intel.com Software Product Support info: http://www.intel.com/software/support

This was actually a deficiency in Valgrind; it gets confused by aligned vector loads that extend past the end of an allocated memory block.

https://bugs.kde.org/show_bug.cgi?id=294285

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.

Laisser un commentaire

Veuillez ouvrir une session pour ajouter un commentaire. Pas encore membre ? Rejoignez-nous dès aujourd’hui