Bug 357010

Summary: drd regression tests fail to compile with Intel compiler
Product: [Developer tools] valgrind Reporter: Tanya <tatyana.a.volnina>
Component: drdAssignee: Bart Van Assche <bart.vanassche+kde>
Status: RESOLVED INTENTIONAL    
Severity: minor CC: tatyana.a.volnina
Priority: NOR    
Version First Reported In: 3.10 SVN   
Target Milestone: ---   
Platform: RedHat Enterprise Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Proposed workaround

Description Tanya 2015-12-21 18:23:28 UTC
File drd/tests/std_string.cpp fails to compile with Intel compiler (versions 15.0.3, 16.0.0)

Reproducible: Always

Steps to Reproduce:
1. Configure Valgrind to be built with Intel compiler
2. Build regression tests (make regtest)

Actual Results:  
File drd/tests/std_string.cpp fails to compile

Expected Results:  
Regression tests are built and run

The reason is a known bug of Intel compiler. If gcc 5.2.0 headers are used, in certain cases integers are misinterpreted as iterators: https://software.intel.com/en-us/forums/intel-c-compiler/topic/565143 . The compiler bug has high priority, but it is difficult to fix. The workaround is to change argument type from integer to double for Intel compilation.
Comment 1 Tanya 2015-12-21 18:25:14 UTC
Created attachment 96238 [details]
Proposed workaround
Comment 2 Tanya 2015-12-21 18:27:59 UTC
Comment on attachment 96238 [details]
Proposed workaround

>--- valgrind-3.11.0/drd/tests/std_string.cpp	2015-09-08 16:23:31.000000000 +0300
>+++ valgrind-3.11.0/drd/tests/std_string.cpp	2015-12-15 21:47:14.114795475 +0300
>@@ -35,7 +35,13 @@
> {
>   for (int i = 0; i < 100; i++) {
>     std::string id("000");
>+#ifdef __INTEL_COMPILER
>+// Intel compiler (version 15.0.3 - 16.0.0) fails to compile the following line due to a compiler bug
>+// A known workaround is to use double instead of int
>+    id.append(1.0, 'a' + i);
>+#else
>     id.append(1, 'a' + i);
>+#endif
>     std::list<std::string> record;
>     record.push_back("some data");
>     addRecord();
Comment 3 Bart Van Assche 2018-05-16 19:56:15 UTC
Please reopen this bug if this behavior is reproducible with the latest version of the Intel compiler.