[SERVER-20664] WiredTiger and zlib trigger clang 3.7's Wshift-negative-value warning Created: 28/Sep/15  Updated: 07/Dec/16  Resolved: 09/Oct/15

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: None
Fix Version/s: 3.2.0-rc0

Type: Bug Priority: Major - P3
Reporter: Mathias Stearn Assignee: Mathias Stearn
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on WT-2148 WiredTiger triggers clang 3.7's Wshif... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: QuInt A (10/12/15)
Participants:

 Description   

It is included in Wall so we'll need to either fix them or suppress the warning when building those libraries.

src/third_party/zlib-1.2.8/inflate.c:1507:61: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
    if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;
                                                        ~~~ ^
1 error generated



 Comments   
Comment by Githook User [ 12/Oct/15 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-20664 Pull in zlib -Wshift-negative-value fixes

This is just cherry picking the following two commits from the zlib repo:

https://github.com/madler/zlib/commit/e54e1299404101a5a9d0cf5e45512b543967f958

Avoid shifts of negative values inflateMark().

The C standard says that bit shifts of negative integers is
undefined. This casts to unsigned values to assure a known
result.

-------

https://github.com/madler/zlib/commit/44ae761dc2047038dc42a7e5a162d042fc392d2b

Clean up portability for shifts and integer sizes.
Branch: master
https://github.com/mongodb/mongo/commit/e59924200bd5754698b359c07d4858f05e920f80

Comment by David Hows [ 29/Sep/15 ]

This has been fixed in zlib's development branch

Issue: https://github.com/madler/zlib/issues/111

Comment by Mathias Stearn [ 28/Sep/15 ]

zlib commits:

https://github.com/madler/zlib/commit/e54e1299404101a5a9d0cf5e45512b543967f958
https://github.com/madler/zlib/commit/44ae761dc2047038dc42a7e5a162d042fc392d2b

Generated at Thu Feb 08 03:54:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.