- Notifications
You must be signed in to change notification settings - Fork15
Fix compilation error (-Wstringop-overflow)#68
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or 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
GCC may produce false warnings in some cases when working withstrings (char*) when -Wstringop-overflow is enabled. The patch fixesthe compilation warning that origins in some tricky pointers casts.
esabol approved these changesSep 26, 2023
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.
Nice!
Sign up for freeto 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.
GCC may produce false warnings in some cases when working with strings (char*) when -Wstringop-overflow is enabled. The patch fixes the compilation warning that origins in some tricky pointers casts.
The error message:
g++ -Wall -Wpointer-arith -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -g -O2 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -DPGSPHERE_VERSION=1.3.1 -I. -I./ -I/home/vit/p.pgsphere/local/include/postgresql/server -I/home/vit/p.pgsphere/local/include/postgresql/internal -D_GNU_SOURCE -fopenmp -I/usr/include/healpix_cxx -c -o src/process_moc.o src/process_moc.cpp -MMD -MP -MF .deps/process_moc.Po In file included from /usr/include/string.h:535, from /usr/include/c++/11/cstring:42, from src/process_moc.cpp:2: In function ‘void* memmove(void*, const void*, size_t)’, inlined from ‘void rpage_iter<V, page_size, value_size>::set(const V&) [with V = moc_interval; long unsigned int page_size = 1996; long unsigned int value_size = 16]’ at src/process_moc.cpp:336:15, inlined from ‘void create_moc_release_context(void*, Smoc*, pgs_error_handler)’ at src/process_moc.cpp:604:9: /usr/include/x86_64-linux-gnu/bits/string_fortified.h:36:34: warning: writing 16 bytes into a region of size 2 [-Wstringop-overflow=] 36 | return __builtin___memmove_chk (__dest, __src, __len, | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ 37 | __glibc_objsize0 (__dest)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from src/process_moc.cpp:19: src/pgs_process_moc.h: In function ‘void create_moc_release_context(void*, Smoc*, pgs_error_handler)’: src/pgs_process_moc.h:58:25: note: destination object ‘Smoc::version’ of size 2 58 | uint16 version; /* version of the 'toasty' MOC data structure */