[odb-users] gcc 13.2: vector.ixx: warning: ‘i’ may be used uninitialized

Boris Kolpackov boris at codesynthesis.com
Mon Sep 9 07:10:36 EDT 2024


Siegmund, Harald <Harald.Siegmund at isotravel.com> writes:

>   insert (iterator p, I f, I l)
>   {
>     size_type i, n;
>     if (_tracking ())
>     {
>       i = static_cast<size_type> (p.base () - v_.begin ());
>       n = v_.size ();
>     }
> 
>     v_.insert (p.base (), f, l);
> 
>     if (_tracking ())
>       impl_.insert (i, v_.size () - n);
>   }
> 
> I can see the compiler's point: Function _tracking() could hypothetically
> return different results in each invocation, so IMHO the warning message
> is appropriate.

The _tracking() function is inline so the compiler should be able to
see through it. What probably causes this is a non-inline call between
the two of them, which could potentially change the value _tracking()
is based on.

In any case, should be fixed now, thanks for the report:

https://git.codesynthesis.com/cgit/odb/odb/commit/?id=54389be6199234c644b26bfdfb7333f82603bbd6



More information about the odb-users mailing list