Possibly uninitialized variables...compile time error

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Possibly uninitialized variables...compile time error

Edwards, Mark C.
sqlite3.c(167291): error C4703: potentially uninitialized local pointer variable 'pNode' used
sqlite3.c(168154): error C4703: potentially uninitialized local pointer variable 'pRoot' used
sqlite3.c(168160): error C4703: potentially uninitialized local pointer variable 'pChild' used

Two of these are present in the 3.21.0 version. This is the amalgamated source for 3.20.1 that
I tried out last night in hopes that I would get a good build.  Setting the pointer values to NULL
where initially declared will resolve the problem.

I want to incorporate the latest SQLite3 release into my current build with no changes
to the released source as evidenced by a matching SHA3 sum as published.  The 3.21.0
fails that objective. I could fix it with just a couple simple edits, but that violates the
integrity of the checksum.

The above problem occurs in an X86 Release build using Visual Studio 2015 Pro
and link time code generation.

___________________________________________
Mark C Edwards
Chief Scientist, C2 Systems Engineering & Integration
779 Monika Ct
Chubbuck, ID 83202
[hidden email]
Mobile: 208-241-7982


_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Possibly uninitialized variables...compile time error

Richard Hipp-3
On 12/15/17, Edwards, Mark C. <[hidden email]> wrote:
> sqlite3.c(167291): error C4703: potentially uninitialized local pointer
> variable 'pNode' used
> sqlite3.c(168154): error C4703: potentially uninitialized local pointer
> variable 'pRoot' used
> sqlite3.c(168160): error C4703: potentially uninitialized local pointer
> variable 'pChild' used

All these warnings are false positives.  The variables are initialized
by prior calls to the nodeAcquire() function.  The problem is that
nodeAcquire() does not necessarily initialize the variables, but if it
does not, it returns a result code other than SQLITE_OK, and in those
cases, the code that uses the variables that nodeAcquire() was suppose
to have initialized is never reached.  Thus there is no possibility of
using an uninitialized variable.

However, the code in question is not on a critical path.  Hence, I
have now added extra (unnecessary) local variable initializations in
the relevant RTree indexing routines so that these warnings should now
be suppressed.

--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: EXTERNAL: Re: Possibly uninitialized variables...compile time error

Edwards, Mark C.
Thank you. I'm looking forward to a clean build on the next release.

___________________________________________
Mark C Edwards
Chief Scientist, C2 Systems Engineering & Integration
779 Monika Ct
Chubbuck, ID 83202
[hidden email]
Mobile: 208-241-7982



-----Original Message-----
From: sqlite-users [mailto:[hidden email]] On Behalf Of Richard Hipp
Sent: Friday, December 15, 2017 9:42 PM
To: SQLite mailing list <[hidden email]>
Cc: [hidden email]
Subject: EXTERNAL: Re: [sqlite] Possibly uninitialized variables...compile time error

On 12/15/17, Edwards, Mark C. <[hidden email]> wrote:
> sqlite3.c(167291): error C4703: potentially uninitialized local
> pointer variable 'pNode' used
> sqlite3.c(168154): error C4703: potentially uninitialized local
> pointer variable 'pRoot' used
> sqlite3.c(168160): error C4703: potentially uninitialized local
> pointer variable 'pChild' used

All these warnings are false positives.  The variables are initialized by prior calls to the nodeAcquire() function.  The problem is that
nodeAcquire() does not necessarily initialize the variables, but if it does not, it returns a result code other than SQLITE_OK, and in those cases, the code that uses the variables that nodeAcquire() was suppose to have initialized is never reached.  Thus there is no possibility of using an uninitialized variable.

However, the code in question is not on a critical path.  Hence, I have now added extra (unnecessary) local variable initializations in the relevant RTree indexing routines so that these warnings should now be suppressed.

--
D. Richard Hipp
[hidden email]
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users