[LLVMbugs] [Bug 21308] clang/LLVM 3.5.0 skips checking the for loop's condition when entering the loop

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Oct 18 15:45:09 PDT 2014


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

Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |richard-llvm at metafoo.co.uk
         Resolution|---                         |INVALID

--- Comment #8 from Richard Smith <richard-llvm at metafoo.co.uk> ---
(In reply to comment #7)
> So, your statement is that the compiler-generated code will refuse to verify
> a pointer against NULL even if the developer _explicitly_ checks for this in
> C code?

Yes. This is exactly like checking for overflow *after* you perform signed
arithmetic that overflows. You can't put the undefined behavior genie back in
the bottle by checking for it after it happens.

> Is this a new behavior since 3.5.0?

Yes, and it was documented prominently in our release notes:
http://llvm.org/releases/3.5.0/tools/clang/docs/ReleaseNotes.html#c-language-changes-in-clang

You can build with -fsanitize=null to catch these bugs at runtime.

-- 
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/20141018/33d6d48b/attachment.html>


More information about the llvm-bugs mailing list