[LLVMbugs] [Bug 22556] New: placement new null checks should be optimized away

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Feb 11 18:43:47 PST 2015


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

            Bug ID: 22556
           Summary: placement new null checks should be optimized away
           Product: clang
           Version: 3.5
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vlovich at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Although the C++ standard address the placement-new/nullptr issue in C++17, it
would seem like the optimizer should be able to optimize away the cost
regardless, at least for vector.

Although placement new could be being called on a nullptr, it will be called
with p[i] where i is some value in [0, size() - 1].

Except for the p[0] case, p[x] where x is in [1, size() - 1] cannot be a
nullptr since pointer arithmetic is undefined behaviour for overflow.

Test-case code:
https://pastebin.mozilla.org/8625250

More information:
http://www.reddit.com/r/cpp/comments/2v3viw/cs_placementnew_prevents_optimalcode_generation/

-- 
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/20150212/7891c183/attachment.html>


More information about the llvm-bugs mailing list