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

Duncan Sands <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |[email protected]
         Resolution|---                         |INVALID

--- Comment #1 from Duncan Sands <[email protected]> ---
Overflow when multiplying two signed numbers results in undefined behaviour
according to the C standard.  Thus the compiler is free to introduce code that
fires a nuclear missile, wipes your hard-drive etc, if the multiplication does
in fact overflow.  Fortunately the compiler only inserted code that sets err to
zero in this case, phew!

As overflow when multiplying unsigned numbers does not result in undefined
behaviour you can fix your code by replacing
  r = x * y;
with
  r = (long long)((unsigned long long)x * (unsigned long long)y);

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to