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.
