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: unassignedb...@nondot.org
          Reporter: douglas_y...@playstation.sony.com
                CC: htmldevelo...@gmail.com, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to