lvgl / lv_demos

Examples, tutorials and applications for the LVGL embedded GUI library
https://lvgl.io
488 stars 366 forks source link

lv_demo_benchmark causes floating point exception #123

Closed higaski closed 2 years ago

higaski commented 2 years ago

The function rnd_next in the lv_demo_benchmark causes a floating point exception in line 1007 in case both input arguments are equal.

static int32_t rnd_next(int32_t min, int32_t max)
{
    if(min > max) {
        int32_t t = min;
        min = max;
        max = t;
    }

    int32_t d = max - min;
    int32_t r = (rnd_map[rnd_act] % d) + min;  // Exception here

    rnd_act++;
    if(rnd_act >= RND_NUM) rnd_act = 0;

    return r;

}
kisvegabor commented 2 years ago

This case is handles here: https://github.com/lvgl/lv_demos/blob/1c0552beff27aee1cdc82ddd32340f4b9c1f1995/src/lv_demo_benchmark/lv_demo_benchmark.c#L1004-L1005

higaski commented 2 years ago

Oh I'm sorry, I was still checking out v8.0.1... silly me.