mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-05 14:34:55 +00:00
Don't try to create a GEP when the pointee type is unsized (such GEPs
are invalid). Fixes a crash on array1.C from the GCC testsuite when compiled with dragonegg. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147946 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e4bc80a14b
commit
1876abe63e
@ -104,7 +104,8 @@ static Constant *FoldBitCast(Constant *V, Type *DestTy) {
|
||||
// the first element. If so, return the appropriate GEP instruction.
|
||||
if (PointerType *PTy = dyn_cast<PointerType>(V->getType()))
|
||||
if (PointerType *DPTy = dyn_cast<PointerType>(DestTy))
|
||||
if (PTy->getAddressSpace() == DPTy->getAddressSpace()) {
|
||||
if (PTy->getAddressSpace() == DPTy->getAddressSpace()
|
||||
&& DPTy->getElementType()->isSized()) {
|
||||
SmallVector<Value*, 8> IdxList;
|
||||
Value *Zero =
|
||||
Constant::getNullValue(Type::getInt32Ty(DPTy->getContext()));
|
||||
|
12
test/Transforms/InstCombine/2012-01-11-OpaqueBitcastCrash.ll
Normal file
12
test/Transforms/InstCombine/2012-01-11-OpaqueBitcastCrash.ll
Normal file
@ -0,0 +1,12 @@
|
||||
; RUN: opt < %s -instcombine -disable-output
|
||||
|
||||
%opaque_struct = type opaque
|
||||
|
||||
@G = external global [0 x %opaque_struct]
|
||||
|
||||
declare void @foo(%opaque_struct*)
|
||||
|
||||
define void @bar() {
|
||||
call void @foo(%opaque_struct* bitcast ([0 x %opaque_struct]* @G to %opaque_struct*))
|
||||
ret void
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user