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

            Bug ID: 48577
           Summary: [InstCombine] non-inbounds GEP of null pointer
                    miscompiled
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedb...@nondot.org
          Reporter: nikita....@gmail.com
                CC: llvm-bugs@lists.llvm.org

https://llvm.godbolt.org/z/qec9oz

define i8 @test(i8* %p) {
  %i = ptrtoint i8* %p to i64
  %g = getelementptr i8, i8* null, i64 %i
  %v = load i8, i8* %g, align 1
  ret i8 %v
}

; RUN: opt -S -instcombine < %s

define i8 @test(i8* %p) {
  store i8 undef, i8* null, align 536870912
  ret i8 undef
}

As the GEP is not inbounds, the original code should be well-defined.

Rust bug report: https://github.com/rust-lang/rust/issues/80309

-- 
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