Skip to content
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

build warning with gcc 12 #54736

Closed
richardlau opened this issue Sep 3, 2024 · 4 comments
Closed

build warning with gcc 12 #54736

richardlau opened this issue Sep 3, 2024 · 4 comments
Labels
build Issues and PRs related to build files or the CI.

Comments

@richardlau
Copy link
Member

We recently switched to build with gcc 12 on RHEL (other platforms to follow) in nodejs/build#3886.
This is causing ubi81_sharedlibs_openssl111fips_x64 to fail as it builds with --error-on-warn.

e.g. https://ci.nodejs.org/job/node-test-commit-linux-containered/45894/nodes=ubi81_sharedlibs_openssl111fips_x64/

07:14:38 In file included from /opt/rh/gcc-toolset-12/root/usr/include/c++/12/string:40,
07:14:38                  from /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/locale_classes.h:40,
07:14:38                  from /opt/rh/gcc-toolset-12/root/usr/include/c++/12/locale:39,
07:14:38                  from ../src/util-inl.h:29,
07:14:38                  from ../src/node_dotenv.h:6,
07:14:38                  from ../src/node_dotenv.cc:1:
07:14:38 In static member function 'static constexpr std::char_traits<char>::char_type* std::char_traits<char>::copy(char_type*, const char_type*, std::size_t)',
07:14:38     inlined from 'static constexpr void std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_S_copy(_CharT*, const _CharT*, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/basic_string.h:423:21,
07:14:38     inlined from 'constexpr std::__cxx11::basic_string<_CharT, _Traits, _Allocator>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_M_replace(size_type, size_type, const _CharT*, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/basic_string.tcc:532:22,
07:14:38     inlined from 'constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::replace(size_type, size_type, const _CharT*, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/basic_string.h:2171:19,
07:14:38     inlined from 'constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::replace(size_type, size_type, const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' at /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/basic_string.h:2196:22,
07:14:38     inlined from 'void node::Dotenv::ParseContent(std::string_view)' at ../src/node_dotenv.cc:164:35:
07:14:38 /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/char_traits.h:431:56: error: 'void* __builtin_memcpy(void*, const void*, long unsigned int)' accessing 9223372036854775810 or more bytes at offsets [2, 9223372036854775807] and 1 may overlap up to 9223372036854775813 bytes at offset -3 [-Werror=restrict]
07:14:38   431 |         return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n));
07:14:38       |                                        ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
07:14:38 cc1plus: all warnings being treated as errors
07:14:38 make[2]: *** [libnode.target.mk:445: /home/iojs/build/workspace/node-test-commit-linux-containered/out/Release/obj.target/libnode/src/node_dotenv.o] Error 1
@richardlau
Copy link
Member Author

If we look at a rhel8-x64 build (where we haven't enabled --error-on-warn) we can see several instances of this warning being emitted, e.g. https://ci.nodejs.org/job/node-test-commit-linux/nodes=rhel8-x64/60200/consoleFull.

@richardlau
Copy link
Member Author

richardlau commented Sep 3, 2024

@RedYetiDev RedYetiDev added the build Issues and PRs related to build files or the CI. label Sep 3, 2024
@richardlau
Copy link
Member Author

Other examples
https://ci.nodejs.org/job/node-test-commit-linux/nodes=rhel8-x64/60200/consoleFull

15:21:13     inlined from ‘void node::Dotenv::ParseContent(std::string_view)’ at ../src/node_dotenv.cc:164:35:
15:21:13 /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/char_traits.h:431:56: warning: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ accessing 9223372036854775810 or more bytes at offsets [2, 9223372036854775807] and 1 may overlap up to 9223372036854775813 bytes at offset -3 [-Wrestrict]
15:21:13   431 |         return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n));
15:21:13       |                                        ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
15:21:16     inlined from ‘virtual std::string node::SocketAddressBlockList::SocketAddressMaskRule::ToString()’ at ../src/node_sockaddr.cc:500:14:
15:21:16 /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/char_traits.h:431:56: warning: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ accessing 9223372036854775810 or more bytes at offsets [2, 9223372036854775807] and 1 may overlap up to 9223372036854775813 bytes at offset -3 [-Wrestrict]
15:21:16   431 |         return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n));
15:21:16       |                                        ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
15:21:16     inlined from ‘node::task_runner::ProcessRunner::ProcessRunner(std::shared_ptr<node::InitializationResultImpl>, const std::filesystem::__cxx11::path&, std::string_view, std::string_view, std::string_view, const node::task_runner::PositionalArgs&)’ at ../src/node_task_runner.cc:58:26:
15:21:16 /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/char_traits.h:431:56: warning: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ accessing 9223372036854775810 or more bytes at offsets [2, 9223372036854775807] and 1 may overlap up to 9223372036854775813 bytes at offset -3 [-Wrestrict]
15:21:16   431 |         return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n));
15:21:16       |                                        ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
15:21:16     inlined from ‘static void node::url::BindingData::Format(const v8::FunctionCallbackInfo<v8::Value>&)’ at ../src/node_url.cc:228:38:
15:21:16 /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/char_traits.h:431:56: warning: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ accessing 9223372036854775810 or more bytes at offsets [2, 9223372036854775807] and 1 may overlap up to 9223372036854775813 bytes at offset -3 [-Wrestrict]
15:21:16   431 |         return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n));
15:21:16       |                                        ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
15:21:20     inlined from ‘void node::crypto::LogSecret(const SSLPointer&, const char*, const unsigned char*, std::size_t)’ at ../src/crypto/crypto_common.cc:61:15:
15:21:20 /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/char_traits.h:431:56: warning: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ accessing 9223372036854775810 or more bytes at offsets [2, 9223372036854775807] and 1 may overlap up to 9223372036854775813 bytes at offset -3 [-Wrestrict]
15:21:20   431 |         return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n));
15:21:20       |                                        ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
15:21:20     inlined from ‘void node::crypto::LogSecret(const SSLPointer&, const char*, const unsigned char*, std::size_t)’ at ../src/crypto/crypto_common.cc:64:11:
15:21:20 /opt/rh/gcc-toolset-12/root/usr/include/c++/12/bits/char_traits.h:431:56: warning: ‘void* __builtin_memcpy(void*, const void*, long unsigned int)’ accessing 9223372036854775810 or more bytes at offsets [2, 9223372036854775807] and 1 may overlap up to 9223372036854775813 bytes at offset -3 [-Wrestrict]
15:21:20   431 |         return static_cast<char_type*>(__builtin_memcpy(__s1, __s2, __n));
15:21:20       |                                        ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~

@richardlau
Copy link
Member Author

I've opened #54737 to turn off -Wrestrict (i.e. -Wno-restrict).

aduh95 pushed a commit that referenced this issue Sep 4, 2024
PR-URL: #54737
Refs: #54736
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
aduh95 pushed a commit that referenced this issue Sep 12, 2024
PR-URL: #54737
Refs: #54736
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
targos pushed a commit that referenced this issue Sep 22, 2024
PR-URL: #54737
Refs: #54736
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
targos pushed a commit that referenced this issue Sep 26, 2024
PR-URL: #54737
Refs: #54736
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
targos pushed a commit that referenced this issue Oct 2, 2024
PR-URL: #54737
Refs: #54736
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
louwers pushed a commit to louwers/node that referenced this issue Nov 2, 2024
PR-URL: nodejs#54737
Refs: nodejs#54736
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI.
Projects
None yet
Development

No branches or pull requests

2 participants