On Thu, Mar 16, 2017 at 5:00 PM, Dibyendu Majumdar <mobile@xxxxxxxxxxxxxxx> wrote: > > The cast to double has been removed. I am trying to understand where > this is happening as it seems to happen quite early on. Any tips on > where I should look? Since sparse was mostly done for kernel stuff, there's almost no floating point support anywhere. There's something seriously screwed up with explicit double casting. See the differences between double f1(void) { return -1; } double f2(void) { return (double)-1; } double f3(void) { return -1.0; } and notice how the first one and third ones actually kind-of make sense. The second one? Not so much, it just uses a 64-bit integer. The bug is already at the parse tree stage, the linearization doesn't even see the cast. I think it's this, in simplify_cast(): /* A cast of a constant? */ if (constant(src)) { int sign = orig_type->ctype.modifiers & MOD_SIGNED; long long val = get_cast_value(src->value, orig_size, size, sign); src = value_pseudo(val); goto simplify; } which doesn't even check whether it's a FP value, it just looks if it's a constant and assumes it's an integer. At least it checks the sign ;) Linus -- 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