/** * For svcomp, there are two architectures: 32-bit and 64-bit. * * <p>https://wiki.debian.org/ArchitectureSpecificsMemo For 32-bit, uses i386 in the above link; * for 64-bit, amd64. * * <p>short int long long long float double long double void* * * <p>The size of types is factoring out here: * * <ul> * <li>sizeof(short)=2 * <li>sizeof(int)=4 * <li>sizeof(long)=sizeof(void*) * <li>sizeof(long long)=8 * <li>sizeof(float)=4 * <li>sizeof(double)=8 * <li>sizeof(void*)=4 if 32-bit; 8 if 64-bit. * </ul> * * @return returns the size (a positive integer) of the given type; or -1 if the size of that type * is not specified or can't be decided statically. */ private int sizeofType(Type type) { if (this.configuration.architecture() == Architecture.UNKNOWN) return -1; TypeKind typeKind = type.kind(); switch (typeKind) { case BASIC: { StandardBasicType basicType = (StandardBasicType) type; BasicTypeKind basicKind = basicType.getBasicTypeKind(); switch (basicKind) { case SIGNED_CHAR: case UNSIGNED_CHAR: case CHAR: return 1; case DOUBLE: return 8; case FLOAT: return 4; case UNSIGNED: case INT: return 4; case UNSIGNED_LONG: case LONG: if (this.configuration.architecture() == Architecture._32_BIT) return 4; else return 8; case UNSIGNED_LONG_LONG: case LONG_LONG: return 8; case UNSIGNED_SHORT: case SHORT: return 2; default: return -1; } } case ARRAY: { ArrayType arrayType = (ArrayType) type; int sizeOfEleType = this.sizeofType(arrayType.getElementType()); IntegerValue size = arrayType.getConstantSize(); if (size == null || sizeOfEleType < 0) return -1; return size.getIntegerValue().intValue() * sizeOfEleType; } case OTHER_INTEGER: return 4; case POINTER: { if (this.configuration.architecture() == Architecture._32_BIT) return 4; else return 8; } default: { return -1; } } }
@Override public IntegerValue plusOne(IntegerValue value) { return integerValue(value.getType(), value.getIntegerValue().add(BigInteger.ONE)); }