-
Notifications
You must be signed in to change notification settings - Fork 70
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
Use default new C++11 ABI for std::string and std::list in libstdc++ #31
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This flag was once used as a work-around for very old linkers and has not been needed for a long time. The ABI change does not affect the public runtime ABI since the runtime does not expose any C++ symbols. The ABI change does affect the size of OpenCL data structures, however these are not exposed directly but only in the form of opaque pointers. https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
zibaiwan
previously approved these changes
Dec 3, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thanks @pcolberg .
0066c42
to
b69dd25
Compare
After switching libstdc++ from the old to the default, new C++11 ABI, Klocwork static analysis flags that assignment to std::string with a string literal may result in a non null terminated string. While it is not apparent whether this is a false-positive or not, initializing the string with the literal by default resolves the Klocwork issue. --------------------------------------------------------------------------- 182 (Local) /__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/src/acl_hal_mmd.cpp:782 NNTS.MUST (1:Critical) Analyze Buffer overflow of 'board_vendor_path._M_dataplus._M_p' due to non null terminated string 'board_vendor_path._M_dataplus._M_p' * acl_hal_mmd.cpp:773: customer_board_vendor_path is false * acl_hal_mmd.cpp:779: 'board_vendor_path._M_dataplus._M_p' may not be null-terminated after calling 'operator='. * basic_string.h:705: 'this->_M_dataplus._M_p' may not be null-terminated after calling 'assign'. * basic_string.h:1438: 'this->_M_dataplus._M_p' may not be null-terminated after calling '_M_replace'. * basic_string.tcc:429: __new_size<=this->capacity() is false * basic_string.tcc:465: 'this->_M_dataplus._M_p' may not be null-terminated after calling '_M_mutate'. * basic_string.tcc:318: __pos is true * basic_string.tcc:319: '__r' may not be null-terminated after calling '_S_copy'. * basic_string.h:348: __n==1 is false * basic_string.h:351: '__d' may not be null-terminated after calling 'copy'. * char_traits.h:365: The size parameter may be less than length of source buffer. * char_traits.h:365: '__s1' may not be null-terminated after calling '__builtin_memcpy'. * basic_string.tcc:320: __len2 is false * basic_string.tcc:320: __s&&__len2 is false * basic_string.tcc:322: __how_much is false * basic_string.tcc:327: _M_data(__r): copies '__r' into 'this->_M_dataplus._M_p' * acl_hal_mmd.cpp:783: board_vendor_path.c_str(): returns 'board_vendor_path._M_dataplus._M_p' * acl_hal_mmd.cpp:782: String 'board_vendor_path._M_dataplus._M_p' is not properly terminated and is passed as an argument to function 'printf'. Current status 'Analyze' --------------------------------------------------------------------------- 183 (Local) /__w/fpga-runtime-for-opencl/fpga-runtime-for-opencl/src/acl_hal_mmd.cpp:798 NNTS.MUST (1:Critical) Analyze Buffer overflow of 'board_vendor_path._M_dataplus._M_p' due to non null terminated string 'board_vendor_path._M_dataplus._M_p' * acl_hal_mmd.cpp:773: customer_board_vendor_path is false * acl_hal_mmd.cpp:779: 'board_vendor_path._M_dataplus._M_p' may not be null-terminated after calling 'operator='. * basic_string.h:705: 'this->_M_dataplus._M_p' may not be null-terminated after calling 'assign'. * basic_string.h:1438: 'this->_M_dataplus._M_p' may not be null-terminated after calling '_M_replace'. * basic_string.tcc:429: __new_size<=this->capacity() is false * basic_string.tcc:465: 'this->_M_dataplus._M_p' may not be null-terminated after calling '_M_mutate'. * basic_string.tcc:318: __pos is true * basic_string.tcc:319: '__r' may not be null-terminated after calling '_S_copy'. * basic_string.h:348: __n==1 is false * basic_string.h:351: '__d' may not be null-terminated after calling 'copy'. * char_traits.h:365: The size parameter may be less than length of source buffer. * char_traits.h:365: '__s1' may not be null-terminated after calling '__builtin_memcpy'. * basic_string.tcc:320: __len2 is false * basic_string.tcc:320: __s&&__len2 is false * basic_string.tcc:322: __how_much is false * basic_string.tcc:327: _M_data(__r): copies '__r' into 'this->_M_dataplus._M_p' * acl_hal_mmd.cpp:782: debug_verbosity>=1 is false * acl_hal_mmd.cpp:821: debug_verbosity>=1 is false * acl_hal_mmd.cpp:798: board_vendor_path.c_str(): returns 'board_vendor_path._M_dataplus._M_p' * acl_hal_mmd.cpp:798: String 'board_vendor_path._M_dataplus._M_p' is not properly terminated and is passed as an argument to function 'opendir'. Current status 'Analyze'
b69dd25
to
0b9d6cd
Compare
Thanks @zibaiwan. I have updated the commit message of the Klocwork fix after the test proved successful. |
zibaiwan
approved these changes
Dec 3, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This flag was once used as a work-around for very old linkers and has
not been needed for a long time. The ABI change does not affect the
public runtime ABI since the runtime does not expose any C++ symbols.
The ABI change does affect the size of OpenCL data structures, however
these are not exposed directly but only in the form of opaque pointers.
https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html