Skip to content

Commit e16c2e4

Browse files
committed
Fix that array accessor is not generated correctly.
1 parent 0447fdf commit e16c2e4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/Target/CBackend/CBackend.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,7 +1818,7 @@ void CWriter::generateHeader(Module &M) {
18181818
Out << "#include <limits.h>\n"; // With overflow intrinsics support.
18191819
Out << "#include <stdint.h>\n"; // Sized integer support
18201820
Out << "#include <math.h>\n"; // definitions for some math functions and numeric constants
1821-
Out << "#include <APInt-C.h>\n"; // Implementations of many llvm intrinsics
1821+
//Out << "#include <APInt-C.h>\n"; // Implementations of many llvm intrinsics
18221822
// Provide a definition for `bool' if not compiling with a C++ compiler.
18231823
Out << "#ifndef __cplusplus\ntypedef unsigned char bool;\n#endif\n";
18241824
Out << "\n";
@@ -4324,11 +4324,11 @@ void CWriter::printGEPExpression(Value *Ptr, gep_type_iterator I,
43244324
assert(I.getOperand()->getType()->isIntegerTy()); // TODO: indexing a Vector with a Vector is valid, but we don't support it here
43254325
if (I.isStruct()) {
43264326
Out << ".field" << cast<ConstantInt>(I.getOperand())->getZExtValue();
4327-
} else if ((I.getStructType())->isArrayTy()) {
4327+
} else if (I.isBoundedSequential()) {
43284328
Out << ".array[";
43294329
writeOperandWithCast(I.getOperand(), Instruction::GetElementPtr);
43304330
Out << ']';
4331-
} else if (!(I.getStructType())->isVectorTy()) {
4331+
} else if (!I.isSequential()) {
43324332
Out << '[';
43334333
writeOperandWithCast(I.getOperand(), Instruction::GetElementPtr);
43344334
Out << ']';

0 commit comments

Comments
 (0)