[LLVMbugs] [Bug 12047] New: InstCombine pass generates an out-of-bounds stack store

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 21 01:55:52 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=12047

             Bug #: 12047
           Summary: InstCombine pass generates an out-of-bounds stack
                    store
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: eugeni.stepanov at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


In the following example InstCombine pass replaces a 16-byte "struct.S" stack
allocation with a 12-byte "i96" stack allocation, even though there is a
subsequent access to bytes 12-16 of struct.S (the last store).

$ cat ../3.ll

target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:64-n32-S64"
target triple = "armv4t---eabi"

%struct.B = type { i32 }
%struct.A = type { i8*, i8*, i8* }
%struct.S = type { %struct.A, %struct.B }

declare void @_Z10zzz_insert1S(%struct.S*)

define i32 @_Z2ffv() {
entry:
  %a = alloca %struct.S, align 4
  %b = bitcast %struct.S* %a to i96*
  store i96 0, i96* %b, align 4
  %c = getelementptr inbounds %struct.S* %a, i32 0, i32 1, i32 0
  store i32 0, i32* %c, align 4
  ret i32 0
}


$ ./Debug+Asserts/bin/opt ../3.ll -instcombine -S

; ModuleID = '../3.ll'
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:64-n32-S64"
target triple = "armv4t---eabi"

%struct.S = type { %struct.A, %struct.B }
%struct.A = type { i8*, i8*, i8* }
%struct.B = type { i32 }

declare void @_Z10zzz_insert1S(%struct.S*)

define i32 @_Z2ffv() {
entry:
  %a = alloca i96, align 8
  %tmpcast = bitcast i96* %a to %struct.S*
  store i96 0, i96* %a, align 8
  %c = getelementptr inbounds %struct.S* %tmpcast, i32 0, i32 1, i32 0
  store i32 0, i32* %c, align 4
  ret i32 0
}

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list