[LLVMbugs] [Bug 19644] New: Miscompile with x86 hosted release compiler targeting x64

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri May 2 13:06:52 PDT 2014


            Bug ID: 19644
           Summary: Miscompile with x86 hosted release compiler targeting
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: MC
          Assignee: unassignedbugs at nondot.org
          Reporter: douglas_yung at playstation.sony.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

I am running an x86 linux hosted release compiler targeting x64 linux, and I am
seeing the dumper which writes the generated machine instructions to a file
seems to be messing up somewhere in the process. Note that this only seems to
occur in the x86 release compiler when targeting x64. A debug+asserts build of
the same compiler does NOT exhibit this issue. 

Test environment:
•    Compiler: i386-pc-linux-gnu
•    Compiler build: Release (does not repro with Debug+Asserts built compiler)
•    Target: x86_64-pc-linux-gnu
•    Host OS: Linux (Ubuntu 13.10)
•    SVN Revision: 207280
•    Compiler used to build LLVM: gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1

The LLVM IR which reproduces the issue is the following:

target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

%struct.S5303X7 = type { i56, [2 x i32] }

; Function Attrs: uwtable
define internal void @_ZL12Test_S5303X7v() #0 {
  %lv = alloca %struct.S5303X7*, align 8
  %1 = call noalias i8* @_Znwm(i64 16) #3
  %2 = bitcast i8* %1 to %struct.S5303X7*
  store %struct.S5303X7* %2, %struct.S5303X7** %lv, align 8
  %3 = load %struct.S5303X7** %lv, align 8
  %4 = bitcast %struct.S5303X7* %3 to i64*
  %5 = load i64* %4, align 4
  %6 = and i64 %5, -2251799813685249
  store i64 %6, i64* %4, align 4
  ret void

; Function Attrs: nobuiltin
declare noalias i8* @_Znwm(i64) #2

To see the issue, compile this using a x86 hosted Release build of the compiler
and use the command “llc repro.ll –filetype=asm –o repro.s –O0”. If you look at
the generated assembly file, you will see that the constant “-2251799813685249”
has been changed to “-1”. If you compile with a Debug+Asserts compiler, the
constant is unaltered. If you add the options “-print-machineinstrs” and
“-show-mc-inst” you can see that after each pass the constant is still correct,
but once it gets written to the file, it is incorrectly changed to -1.

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/20140502/0676f965/attachment.html>

More information about the llvm-bugs mailing list