[LLVMbugs] [Bug 18558] illegal hardware instruction emitted

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jan 20 05:47:24 PST 2014


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

jonathan.sauer at gmx.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jonathan.sauer at gmx.de
         Resolution|---                         |INVALID

--- Comment #2 from jonathan.sauer at gmx.de ---
Your code is invoking undefined behavior: N1570 (C11) §6.5.6p9:

| When two pointers are subtracted, both shall point to elements of the same
| array object, or one past the last element of the array object; the result
| is the difference of the subscripts of the two array elements.

A NULL pointer doesn't point to any array object. In C++ it's N3289 §5.7p6 and
p7.

Remove the two (char*) casts, and the code runs successfully.

-- 
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/20140120/58c713b4/attachment.html>


More information about the llvm-bugs mailing list