sparse-llvm incorrect handling of comparison ops when pointers are involved

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

It appears that the handling of comparison operators is not correct
when pointer types are involved - the code attempts floating point
comparison. A potential fix might be:

/* Binary comparison */
case OP_SET_EQ:
case OP_SET_NE:
case OP_SET_LE:
case OP_SET_GE:
case OP_SET_LT:
case OP_SET_GT:
case OP_SET_B:
case OP_SET_A:
case OP_SET_BE:
case OP_SET_AE: {
LLVMTypeRef dst_type = insn_symbol_type(C, fn->module, insn);

if (LLVMGetTypeKind(LLVMTypeOf(lhs)) == LLVMIntegerTypeKind ||
LLVMGetTypeKind(LLVMTypeOf(lhs)) == LLVMPointerTypeKind) {
LLVMIntPredicate op = translate_op(insn->opcode);

target = LLVMBuildICmp(fn->builder, op, lhs, rhs, target_name);
} else {
LLVMRealPredicate op = translate_fop(insn->opcode);

target = LLVMBuildFCmp(fn->builder, op, lhs, rhs, target_name);
}

target = LLVMBuildZExt(fn->builder, target, dst_type, target_name);
break;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux