This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 'SR.1419' is used uninitialized in this function...


On Tue, Jan 25, 2005 at 12:48:58PM -0800, Benjamin Redelings wrote:

> I now have a 30-line test-case (attatched) which triggers two bugs:
> a) the structure member has a name, but is not named.
> b) the structure member is not actually used, despite the warning.

It's used in the compiler-generated copy constructor, which would be
something like this:

    iterator(const iterator& other) : circuits(other.circuits) {}

and it is called when branchview::my_iterator returns by value.

> Ways to make the problem go away include:
> a) make a function non-virtual
> b) make a function not a template
> c) remove the undefined, and supposedly unused variable.
> d) turn off all optimization.

Or alternatively, initialise the variable in the constructor:

    iterator() : circuits() {}

jon

-- 
Dull but sincere filler


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]