On Sun, Mar 23, 2014 at 01:23:33PM +0100, Johan Engelen wrote:
Hi all, GCC 4.6.1 gives an uninit var warning in sp-canvas.cpp:
src/2geom/generic-interval.h: In static member function 'static void SPCanvasGroup::update(SPCanvasItem*, const Geom::Affine&, unsigned int)':
src/2geom/generic-interval.h:144:8: error: '*((void*)(& bounds)+24).Geom::GenericInterval<double>::_b[1]' may be used uninitialized in this function [-Werror=uninitialized]
src/display/sp-canvas.cpp:1051:19: note: '*((void*)(& bounds)+24).Geom::GenericInterval<double>::_b[1]' was declared here
...
I have been working on this warning for hours, but I cannot find the problem. Because I have already found a (serious) bug from another warning like this, I am very reluctant to conclude that it is a compiler mis-analysis.
I would greatly appreciate someone else having a (thorough) look at this.
Thanks, Johan
Is it just complaining that the array is being initialized in the constructor body rather than set as defaults?
GenericInterval() { _b[0] = 0; _b[1] = 0; }
I.e. it's expecting:
GenericInterval() : _b[0](0), _b[1](0) { }
but you can't initialize array members via defaults.
http://stackoverflow.com/questions/2409819/c-constructor-initializer-for-arr...
If that's the case, not sure how to solve that, other than perhaps not using an array for this class?
Bryce