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

Fix stringop-truncation compile error for gcc9 #8532

Merged
merged 8 commits into from
Jul 1, 2022
Merged

Conversation

EsdeathYZH
Copy link
Contributor

在g++ 9.4.0环境下编译,报了如下错误:

In file included from /usr/include/string.h:495,
                 from /usr/include/python3.8/Python.h:30,
                 from /home/yaozihang/oneflow/oneflow/api/python/framework/tensortype.cpp:16:
In function 'char* strncpy(char*, const char*, size_t)',
    inlined from 'void oneflow::one::generalize_tensor_types()' at /home/yaozihang/oneflow/oneflow/api/python/framework/tensortype.cpp:127:14,
    inlined from 'void OneflowApiPythonModule165(pybind11::module&)' at /home/yaozihang/oneflow/oneflow/api/python/framework/tensortype.cpp:167:26:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: error: 'char* __builtin_strncpy(char*, const char*, long unsigned int)' specified bound 64 equals destination size [-Werror=stringop-truncation]
  106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

参考了https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#Warning-Options 中对此warning的描述解决

@mergify mergify bot merged commit ac0dbf0 into master Jul 1, 2022
@mergify mergify bot deleted the fix_gcc_compile_error branch July 1, 2022 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants