-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warning: unsequenced modification and access to 'range' #1674
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I cannot reproduce this warning. |
@dmax621 Is the issue still visible to you? |
As I mentioned in my original report, I couldn't reproduce this on my development system in the first place. The original message appeared in a log from our CI system, and I wasn't entirely certain which node the tests had been run on, or what the specific node configuration was. I tend to regard it as most likely a compiler bug, possibly due to clang not quite treating |
Thanks for the response! |
I am seeing this same warning. ./json.hpp:7336:71: warning: unsequenced modification and access to 'range' define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1)
|
I upgraded to clang version 9, and the warning went away. FYI: clang 3.8 is the default for Ubuntu 16. |
Also FYI: |
Can you please share the warnings/errors for Clang9 with C++17? |
(Sorry, was on vacation) I could not reproduce the errors at first. Even on original clang 3.8. Some interesting findings! I still cannot reproduce the version 9, c++17 errors. |
What is the issue you have?
Compiler warning about this line in version 3.2.0
json/include/nlohmann/detail/input/lexer.hpp
Line 197 in 9f3857e
That line is (almost) unchanged in the current version
json/include/nlohmann/detail/input/lexer.hpp
Line 206 in ffe0e3d
What is the expected behavior?
No warnings :)
And what is the actual behavior instead?
clang, probably version 3.4.0
CentOS 6 (probably, or possibly 7).
develop
branch?Version 3.2.0
Probably not. The warning was reported by our CI system, which runs tests on whichever of many servers is available, and they have different configurations, in particular different compiler & OS versions. I can't tell which specific machine reported this, and I can't reproduce it on my development system (CentOS 7, clang 3.4.2).
The offending line actually looks perfectly OK to me --
and
should be a sequence point -- although not for overloadedoperator&&
, but this instance has a bool on each side (unless there's some bizarre overloading ofoperator<=
going on).It could be related to clang not quite treating
and
the same as&&
. Or it could be related to theJSON_LIKELY()
macro, and misbehaviour of__builtin_expect(x)
whenx
has side-effects.Anyway, I have fixed this locally by explicitly fetching the range elements in a well-defined sequence (low first, then high) before using them in the comparison (which is then guaranteed to have no side-effects).
The text was updated successfully, but these errors were encountered: