[llvm-bugs] [Bug 48577] New: [InstCombine] non-inbounds GEP of null pointer miscompiled

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 22 14:45:28 PST 2020


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: unassignedbugs at nondot.org
          Reporter: nikita.ppv at gmail.com
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201222/ee95ca7a/attachment.html>


More information about the llvm-bugs mailing list