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

May be uninitialized warnings #27

Closed
Kojoley opened this issue Oct 18, 2018 · 6 comments
Closed

May be uninitialized warnings #27

Kojoley opened this issue Oct 18, 2018 · 6 comments

Comments

@Kojoley
Copy link
Contributor

Kojoley commented Oct 18, 2018

gcc.compile.c++ bin.v2\libs\function\test\function_n_test.test\gcc-8.2.0\release\cxxstd-03-iso\visibility-hidden\function_n_test.o
In file included from ./boost/function/detail/maybe_include.hpp:15,
                 from ./boost/function/function0.hpp:11,
                 from ./boost/test/execution_monitor.hpp:28,
                 from ./boost/test/impl/execution_monitor.ipp:28,
                 from ./boost/test/minimal.hpp:53,
                 from libs\function\test\function_n_test.cpp:10:
./boost/function/function_template.hpp: In function 'void test_construct_destroy_count()':
./boost/function/function_template.hpp:998:24: error: '*((void*)& f +8)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
             std::memcpy(this->functor.data, f.functor.data, sizeof(this->functor.data));
             ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus.exe: all warnings being treated as errors

    "g++"   -std=c++03 -fvisibility-inlines-hidden -m64 -O3 -finline-functions -Wno-inline -Wall -Werror -fvisibility=hidden  -DBOOST_ALL_NO_LIB=1 -DNDEBUG  -I"." -c -o "bin.v2\libs\function\test\function_n_test.test\gcc-8.2.0\release\cxxstd-03-iso\visibility-hidden\function_n_test.o" "libs\function\test\function_n_test.cpp"

...failed gcc.compile.c++ bin.v2\libs\function\test\function_n_test.test\gcc-8.2.0\release\cxxstd-03-iso\visibility-hidden\function_n_test.o...
...skipped <pbin.v2\libs\function\test\function_n_test.test\gcc-8.2.0\release\cxxstd-03-iso\visibility-hidden>function_n_test.exe for lack of <pbin.v2\libs\function\test\function_n_test.test\gcc-8.2.0\release\cxxstd-03-iso\visibility-hidden>function_n_test.o...
...skipped <pbin.v2\libs\function\test\function_n_test.test\gcc-8.2.0\release\cxxstd-03-iso\visibility-hidden>function_n_test.run for lack of <pbin.v2\libs\function\test\function_n_test.test\gcc-8.2.0\release\cxxstd-03-iso\visibility-hidden>function_n_test.exe...
gcc.compile.c++ bin.v2\libs\function\test\function_n_test.test\gcc-8.2.0\release\cxxstd-11-iso\visibility-hidden\function_n_test.o
In file included from ./boost/function/detail/maybe_include.hpp:15,
                 from ./boost/function/function0.hpp:11,
                 from ./boost/test/execution_monitor.hpp:28,
                 from ./boost/test/impl/execution_monitor.ipp:28,
                 from ./boost/test/minimal.hpp:53,
                 from libs\function\test\function_n_test.cpp:10:
./boost/function/function_template.hpp: In function 'void test_construct_destroy_count()':
./boost/function/function_template.hpp:998:24: error: '*((void*)& f +8)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
             std::memcpy(this->functor.data, f.functor.data, sizeof(this->functor.data));
             ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus.exe: all warnings being treated as errors

    "g++"   -std=c++11 -fvisibility-inlines-hidden -m64 -O3 -finline-functions -Wno-inline -Wall -Werror -fvisibility=hidden  -DBOOST_ALL_NO_LIB=1 -DNDEBUG  -I"." -c -o "bin.v2\libs\function\test\function_n_test.test\gcc-8.2.0\release\cxxstd-11-iso\visibility-hidden\function_n_test.o" "libs\function\test\function_n_test.cpp"

...failed gcc.compile.c++ bin.v2\libs\function\test\function_n_test.test\gcc-8.2.0\release\cxxstd-11-iso\visibility-hidden\function_n_test.o...
@pdimov
Copy link
Member

pdimov commented Oct 20, 2018

Technically correct, but I'm not sure what we can do about these. Value-initializing functor in the constructor will be too expensive.

@jeking3
Copy link
Contributor

jeking3 commented Oct 28, 2018

-fvisibility-inlines-hidden is not a common setting to use, right?

@jeking3
Copy link
Contributor

jeking3 commented Oct 28, 2018

Does it happen with cxxstd=11 or later?

@Kojoley
Copy link
Contributor Author

Kojoley commented Oct 28, 2018

-fvisibility-inlines-hidden is not a common setting to use, right?

It is default flags for ./b2 -j3 toolset=gcc-8.2.0 cxxstd=03,11 libs/function/test warnings=on warnings-as-errors=on variant=debug,release

Does it happen with cxxstd=11 or later?

Yes, it is shown in the first post.

@jeking3
Copy link
Contributor

jeking3 commented Oct 28, 2018

Thanks - I missed the second half. I blame my cold.

Romain-Geissler-1A added a commit to Romain-Geissler-1A/function that referenced this issue Mar 27, 2020
Romain-Geissler-1A added a commit to Romain-Geissler-1A/function that referenced this issue Mar 27, 2020
pdimov added a commit that referenced this issue Mar 28, 2020
Avoid -Wmaybe-uninitialized warnings in gcc (issue #27).
@pdimov
Copy link
Member

pdimov commented Mar 28, 2020

Should be fixed by #38.

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

No branches or pull requests

3 participants