On Thu, Mar 1, 2018 at 1:52 PM, Dibyendu Majumdar <mobile@xxxxxxxxxxxxxxx> wrote: > On 1 March 2018 at 20:57, Dibyendu Majumdar <mobile@xxxxxxxxxxxxxxx> wrote: >> On 27 February 2018 at 01:12, Luc Van Oostenryck >> <luc.vanoostenryck@xxxxxxxxx> wrote: >>> On Mon, Feb 26, 2018 at 03:36:38PM -0800, Christopher Li wrote: >>>> >>>> You said you did not found crash in your first round testing. >>>> However there is some regression of the IR. Can you share >>>> the regression test case you found? >>> >>> I didn't spend much time at it but a typical small example >>> of what I've seen is: >>> void a(void) { >>> long b; >>> unsigned c = 0; >>> for (;;) >>> if (c) >>> c = b; >>> } >>> >> >> Now where is the value pseudo of size 64 coming from as it is not in >> the code above? >> > > Okay it seems to come from flow.c in find_dominating_stores() - in the > call to convert_load_instruction(). Any explanation of what this is > doing? That is just the memory operation convert to pseudo. Sparse find out "b" has no dominating store (uninitialized), so it just replace it with 0 value. The 64 bit one is b, the long type. The 32 bit one is c, the int type. I already find out the place cause it: The fix is here: Chris simplify cast of constant using wrong size This fix the test case after the merge. The constant pseudo need to use the target size. Signed-off-by: Christopher Li <sparse@xxxxxxxxxxx> diff --git a/simplify.c b/simplify.c index 09931fe..3d32cdd 100644 --- a/simplify.c +++ b/simplify.c @@ -950,7 +950,7 @@ static int simplify_cast(struct instruction *insn) 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(orig_type, val); + src = value_pseudo(insn->type, val); goto simplify; } -- 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