🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@vitcpp
Copy link
Contributor

@vitcpp vitcpp commented Sep 26, 2023

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 */

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.
Copy link
Contributor

@esabol esabol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@vitcpp vitcpp merged commit 74b3304 into postgrespro:master Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants