[LLVMbugs] [Bug 11555] OpenCL shift counts can overflow

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Mar 23 07:40:12 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=11555

Erik Schnetter <schnetter at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #4 from Erik Schnetter <schnetter at gmail.com> ---
You are correct -- if the arguments are scalars, integer promotion applies.

However, if the left argument of the shift operation is a vector, then integer
promotion does not apply (also OpenCL 6.3.j). This test case demonstrates the
problem:

typedef char char2  __attribute__((__ext_vector_type__(2)));

int main(int argc, char **argv)
{
  char2 x = (char2)1 << (char2)9;
  printf("[%d,%d]\n", x.s0, x.s1);
  return 0;
}

It should output [2,2], but does output [0,0].

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130323/d8e26650/attachment.html>


More information about the llvm-bugs mailing list