From: Johan E. <jbc...@sw...> - 2013-10-30 22:43:13
|
Hi all, Inkscape hits on this warning: src/2geom/generic-interval.h:65:9: warning: assuming signed overflow does not occur when assuming that (X + c) >= X is always true [-Wstrict-overflow] It is caused by this line of code: Geom::IntRect area = Geom::IntRect::from_xywh(floor(event->button.x), floor(event->button.y), 1, 1); Relevant code snippets from our trunk: generic-rect.h: static CRect from_xywh(C x, C y, C w, C h) { CPoint xy(x, y); CPoint wh(w, h); CRect result(xy, xy + wh); return result; } generic-interval.h: GenericInterval(C u, C v) { if (u <= v) { <------ this is line 65 that triggers the warning _b[0] = u; _b[1] = v; } else { _b[0] = v; _b[1] = u; } } I believe the warning is valid for the optimization that GCC will perform. (actually without optimization, I read that the result is undefined when overflow would have occured) How do we kill that warning? Thanks, Johan |