Numeric casting issue when during vectorization

Reference Number :

Version : 
Intel compiler 11.0

Operating System : 

Problem Description : 

The unsigned to double casting produces improper results during vectorization.

The following test case produces wrong result. If we disable vectorization, there is no issue.

$ cat f65372.cpp

// HW: Intel® Core™2 Duo CPU E4600 @ 2.40GHz, 2G memory
// OS: Fedora 10, kernel
// Compiler: icpc 11.0 081, all default compiler settings

#include <inttypes.h>
#include <cstdio>

int main()
    const double res=1.0/4294967296.0;
    double max=0.0;
    int nsiz=16; // smaller nsiz, like 12, would work
    uint32_t urand[nsiz];

    for (int j=0; j < nsiz; ++j)
        urand[j]=0xfffffff0U; // seems to work if MSB is 0

    for (int j=0; j < nsiz; ++j) {
        double err=urand[j]*res; // doesn't work
        //double err=(unsigned int)urand[j]*res; // doesn't work
         //double err=(unsigned long)urand[j]*res; // this works
        if (err > max)

    printf("Max = %.12g\n",max);

// Incorrect output: Max = 4294967296
// Correct output: Max = 0.999999996275

$ icc f65372.cpp
f65372.cpp(17): (col. 2) remark: LOOP WAS VECTORIZED.
f65372.cpp(20): (col. 2) remark: LOOP WAS VECTORIZED.
[maya@maya8 f65372]$ ./a.out
Max = 4294967296

$ icc -no-vec f65372.cpp
[maya@maya8 f65372]$ ./a.out
Max = 0.999999996275

Resolution Status : 

The issue is fixed in Intel C++ compiler v11.1. 

Use the -no-vec compiler option with older versions of the compiler.

[DISCLAIMER: The information on this web site is intended for hardware system manufacturers and software developers. Intel does not warrant the accuracy, completeness or utility of any information on this site. Intel may make changes to the information or the site at any time without notice. Intel makes no commitment to update the information at this site. ALL INFORMATION PROVIDED ON THIS WEBSITE IS PROVIDED "as is" without any express, implied, or statutory warranty of any kind including but not limited to warranties of merchantability, non-infringement of intellectual property, or fitness for any particular purpose. Independent companies manufacture the third-party products that are mentioned on this site. Intel is not responsible for the quality or performance of third-party products and makes no representation or warranty regarding such products. The third-party supplier remains solely responsible for the design, manufacture, sale and functionality of its products. Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. *Other names and brands may be claimed as the property of others.]
For more complete information about compiler optimizations, see our Optimization Notice.