[llvm-bugs] [Bug 27825] New: wrong codegen (miscompile) for weird type

via llvm-bugs llvm-bugs at lists.llvm.org
Fri May 20 08:50:31 PDT 2016


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

            Bug ID: 27825
           Summary: wrong codegen (miscompile) for weird type
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: spatel+llvm at rotateright.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

As noted here:
https://groups.google.com/d/msg/llvm-dev/QhPhmkfwWmY/XCyol-XjCAAJ

Something (during DAG type legalization?) is going wrong in this simple
example: 

@g = constant i8 128
define i8 @main() {
  %ptr = bitcast i8* @g to i7*
  %v7 = load i7, i7* %ptr
;  br label %cmp
;  cmp:
  %ret = zext i7 %v7 to i8
  ret i8 %ret
}

$ ./llc -o - i7.ll | ./clang -x assembler - -o i7 && ./i7 ; echo $?
128

The high bit of the i8 value should have been masked off. If you uncomment the
branch+label, it works as expected (but we should confirm that's not two wrongs
making it right):

$ ./llc -o - i7.ll | ./clang -x assembler - -o i7 && ./i7 ; echo $?
0

-- 
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/20160520/d0878aea/attachment.html>


More information about the llvm-bugs mailing list