[llvm-bugs] [Bug 49022] New: Compiler thinks function is undefined behavior after 292077072e

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 3 10:59:38 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=49022

            Bug ID: 49022
           Summary: Compiler thinks function is undefined behavior after
                    292077072e
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: douglas_yung at playstation.sony.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

We have an internal test that prior to commit
292077072ec1279d89d21873fe900061e55ef936 produced code for the following
function:

void operator delete(void *p) noexcept {}

int test() {
  int *p = new int;
  delete p;
  return 1;
}

When compiled with optimizations enabled (-O2), it would generate the following
llvm IR:

; Function Attrs: norecurse nounwind readnone uwtable willreturn mustprogress
define dso_local i32 @_Z4testv() local_unnamed_addr #1 {
entry:
  ret i32 1
}

But now after 292077072e the compiler seems to think the function is now
undefined behavior and emits the following for it:

; Function Attrs: noreturn nounwind uwtable mustprogress
define dso_local i32 @_Z4testv() local_unnamed_addr #1 {
entry:
  tail call void @llvm.trap()
  unreachable
}

I don't think this is correct, but I'm not sure whether it really is undefined
or not.

-- 
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/20210203/5dbb1a68/attachment.html>


More information about the llvm-bugs mailing list