[SERVER-25385] gcc 6.1 warning: nonnull-compare in util/assert_util.h Created: 01/Aug/16 Updated: 18/Apr/17 Resolved: 17/Aug/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 3.2.13, 3.3.12 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Lucas Morales | Assignee: | Andrew Morrow (Inactive) |
| Resolution: | Done | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Backwards Compatibility: | Fully Compatible | ||||
| Operating System: | ALL | ||||
| Backport Requested: |
v3.2
|
||||
| Sprint: | Platforms 2016-08-26 | ||||
| Participants: | |||||
| Description |
|
This warning prevents build without --disable-warning-as-errors. Source code taken from master on Aug. 1 2016, with hash 2c1272d1e50b177fda189216fadabf1c6797890a
gcc version:
|
| Comments |
| Comment by Githook User [ 18/Apr/17 ] |
|
Author: {u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}Message: The compiler is free to eliminate them anyway, as it would have required (cherry picked from commit b9f8113e7f346f1449193834b77dc22fa4b1d8c7) |
| Comment by Andrew Morrow (Inactive) [ 17/Aug/16 ] |
|
I have fixed the issues reported here, however, I'm unable to locally verify whether the tree compiles under GCC 6. |
| Comment by Githook User [ 17/Aug/16 ] |
|
Author: {u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}Message: The compiler is free to eliminate them anyway, as it would have required |
| Comment by Andrew Morrow (Inactive) [ 08/Aug/16 ] |
|
In both cases, the asserts are called from non-static member functions. As it would be undefined behavior to call such a function on nullptr, I think the compiler is entitled to assume that it doesn't happen in the member function. It would be interesting to see if the compiler is in fact emitting code to check, but in either case I think both instances of this error should be removed. |
| Comment by Michael Hudson-Doyle [ 08/Aug/16 ] |
|
There are two assert calls that hit this warning: (master)mwhudson@aeglos:/opt/opensource/mongo$ git grep -E '[mu]assert.*this)' The warning seems legitimate to me but maybe it's a useful check in some circumstances... |