Compile fails with '-Wall -Werror'

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

Compile fails with '-Wall -Werror'

Brian Kambach
We recently upgraded sqlite from 3.19.3 to 3.21.0 and now building with '-Wall -Werror' fails (when it previously succeeded):

$ gcc -O3 -Wall -Werror -fno-delete-null-pointer-checks -c -o sqlite3.o sqlite3.c
sqlite3.c: In function 'exprAnalyze':
sqlite3.c:131526:37: error: 'pLeft' may be used uninitialized in this function [-Werror=maybe-uninitialized]
         pNewTerm->leftCursor = pLeft->iTable;
                                     ^
sqlite3.c:131529:28: error: 'eOp2' may be used uninitialized in this function [-Werror=maybe-uninitialized]
         pNewTerm->eMatchOp = eOp2;
                            ^
cc1: all warnings being treated as errors

I also noticed that sqlite3.c compiles successfully with -O0, but fails with -O1, -O2, or -O3.

We compile everything with -Werror, so I'm hoping the answer is not "don't use -Werror".

Environment:
OS: CentOS 7
gcc: 4.8.5 20150623 (Red Hat 4.8.5-16)
sqlite: 3.21.0 (SQLITE_SOURCE_ID = "2017-10-24 18:55:49 1a584e499906b5c87ec7d43d4abce641fdf017c42125b083109bc77c4de48827")

_______________________________________________
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: Compile fails with '-Wall -Werror'

Richard Hipp-3
On 12/21/17, Brian Kambach <[hidden email]> wrote:

> We recently upgraded sqlite from 3.19.3 to 3.21.0 and now building with
> '-Wall -Werror' fails (when it previously succeeded):
>
> $ gcc -O3 -Wall -Werror -fno-delete-null-pointer-checks -c -o sqlite3.o
> sqlite3.c
> sqlite3.c: In function 'exprAnalyze':
> sqlite3.c:131526:37: error: 'pLeft' may be used uninitialized in this
> function [-Werror=maybe-uninitialized]
>          pNewTerm->leftCursor = pLeft->iTable;
>                                      ^
> sqlite3.c:131529:28: error: 'eOp2' may be used uninitialized in this
> function [-Werror=maybe-uninitialized]
>          pNewTerm->eMatchOp = eOp2;
>                             ^
> cc1: all warnings being treated as errors
>
> I also noticed that sqlite3.c compiles successfully with -O0, but fails with
> -O1, -O2, or -O3.
>
> We compile everything with -Werror, so I'm hoping the answer is not "don't
> use -Werror".

Both of these warnings are false-positives that arise due to
limitations in the is-initialized theorem prover logic of GCC 4.8.
So, in other words, it is not possible for either pLeft or eOp2 to be
used uninitialized - it is just that GCC 4.8 is unable to construct a
proof of that fact.  If you are unwilling to work-around this problem
by omitting -Werror, then you might try upgrading to GCC 5.4.

--
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: Compile fails with '-Wall -Werror'

Richard Hipp-3
On 12/21/17, Richard Hipp <[hidden email]> wrote:
>
> If you are unwilling to work-around this problem
> by omitting -Werror, then you might try upgrading to GCC 5.4.
>

You can also apply this patch:  https://www.sqlite.org/src/info/64487d658cb3b6c8

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