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

Siegmund, Harald Harald.Siegmund at isotravel.com
Tue Sep 10 03:16:20 EDT 2024


Thanks for the effort. The compiler is quiet now with -O0 but still complains with -O3. This is clearly a gcc issue.


-----Ursprüngliche Nachricht-----
Von: Boris Kolpackov <boris at codesynthesis.com> 
Gesendet: Montag, 9. September 2024 13:11
An: Siegmund, Harald <Harald.Siegmund at isotravel.com>
Cc: odb-users at codesynthesis.com
Betreff: Re: [odb-users] gcc 13.2: vector.ixx: warning: ‘i’ may be used uninitialized

EXTERNAL EMAIL: Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.


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://protection.retarus.com/v1?u=https%3A%2F%2Fgit.codesynthesis.com%2Fcgit%2Fodb%2Fodb%2Fcommit%2F%3Fid%3D54389be6199234c644b26bfdfb7333f82603bbd6&c=3s0vctN&r=4OKduUWa8cgFw1PGWDBE1h&k=7s1&s=YcftIkrI6CtzzERhffgGFjcSJ9EQWtrzQEbxAFbeZ6y



More information about the odb-users mailing list