diff options
| author | Torok Edwin <edwintorok@gmail.com> | 2009-01-24 11:30:49 +0000 |
|---|---|---|
| committer | Torok Edwin <edwintorok@gmail.com> | 2009-01-24 11:30:49 +0000 |
| commit | 73ff92272ffa6b343b541832cc2e39d72a98629f (patch) | |
| tree | 8f2ae7911e2e2076d81e9d1a3f61e20ed562b415 | |
| parent | ee34b8f1791515cfacd4b5eec1e222b5636e1f14 (diff) | |
| download | bcm5719-llvm-73ff92272ffa6b343b541832cc2e39d72a98629f.tar.gz bcm5719-llvm-73ff92272ffa6b343b541832cc2e39d72a98629f.zip | |
void* is represented as pointer to empty struct {}.
Thus we need to check whether the struct is empty before trying to index into
it. This fixes PR3381.
llvm-svn: 62918
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index dd55d65e163..aed08670932 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -11170,6 +11170,8 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) { while (1) { if (const StructType *STy = dyn_cast<StructType>(SrcPTy)) { + if (!STy->getNumElements()) /* Void is represented as {} */ + break; NewGEPIndices.push_back(Zero); SrcPTy = STy->getElementType(0); } else if (const ArrayType *ATy = dyn_cast<ArrayType>(SrcPTy)) { |

