[Bug c++/80328] New: With -ffloat-store std::array operator[] no longer cost-free
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80328 Bug ID: 80328 Summary: With -ffloat-store std::array operator[] no longer cost-free Product: gcc Version: 6.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: pavel.celba at ricardo dot com Target Milestone: --- Following code: #include #include #include #include int main() { static const size_t numIters = 1u; srand(static_cast(time(nullptr))); // Simple type timing float vec[3]; for (int i = 0; i < 3; ++i) vec[i] = static_cast(rand()); clock_t simpleBegin = clock(); for (size_t iter = 0u; iter < numIters; ++iter) for (int i = 0; i < 3; ++i) vec[i] += vec[i]; clock_t simpleEnd = clock(); // Simple type timing std::array vec2; for (int i = 0; i < 3; ++i) vec2[i] = static_cast(rand()); clock_t arrayBegin = clock(); for (size_t iter = 0u; iter < numIters; ++iter) for (int i = 0; i < 3; ++i) vec2[i] += vec2[i]; clock_t arrayEnd = clock(); // Suppress optimizing out whole computation volatile float suppressOptimizingOut[3]; for (int i = 0; i < 3; ++i) { suppressOptimizingOut[i] = vec[i]; suppressOptimizingOut[i] = vec2[i]; } (void)suppressOptimizingOut; // Must use the value to suppress unused warning std::cout << "Simple case time: " << double(simpleEnd - simpleBegin) / CLOCKS_PER_SEC << std::endl; std::cout << "Array case time: " << double(arrayEnd - arrayBegin) / CLOCKS_PER_SEC << std::endl; } Compile options: -Wall -std=c++11 -ffloat-store -O2 -o a.out source_file.cpp There is really no reason too - shouldn't do any additional operations compared to simple case after all optimizations.
[Bug c++/68669] New: -Wunused-variable is not correctly supressed by #pragmas
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68669 Bug ID: 68669 Summary: -Wunused-variable is not correctly supressed by #pragmas Product: gcc Version: 5.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: pavel.celba at ricardo dot com Target Milestone: --- The GCC version info: Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/rs-sync/compilers/gcc/5.1.0/sle11/libexec/gcc/x86_64-unknown-linux-gnu/5.1.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../configure --prefix=/rs-sync/compilers/gcc/5.1.0/sle11 --libdir=/rs-sync/compilers/gcc/5.1.0/sle11/lib64 --enable-lto --enable-gold=yes --enable-ld=yes --with-gmp-include=/rs-sync/compilers/gcc/5.1.0/sle11/include --with-gmp-lib=/rs-sync/compilers/gcc/5.1.0/sle11/lib64 --with-mpfr-include=/rs-sync/compilers/gcc/5.1.0/sle11/include --with-mpfr-lib=/rs-sync/compilers/gcc/5.1.0/sle11/lib64 --with-mpc-include=/rs-sync/compilers/gcc/5.1.0/sle11/include --with-mpc-lib=/rs-sync/compilers/gcc/5.1.0/sle11/lib64 --with-ppl-include=/rs-sync/compilers/gcc/5.1.0/sle11/include --with-ppl-lib=/rs-sync/compilers/gcc/5.1.0/sle11/lib64 Thread model: posix gcc version 5.1.0 (GCC) Including following file from the boost unit test framework - boost version 1.58.0: #include and trying to supress unused-variable warnings still produce unused variable warnings: #ifdef __GNUC__ #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-variable" #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wsign-compare" #endif #include #ifdef __GNUC__ #pragma GCC diagnostic pop #endif E.g. from our company unit test code compilation: In file included from /store/prtc-rsfile/pc1/pc1PlasticLinux/boost/1.58.0/boost/test/unit_test_log.hpp:28:0, from /store/prtc-rsfile/pc1/pc1PlasticLinux/boost/1.58.0/boost/test/test_tools.hpp:20, from /store/prtc-rsfile/pc1/pc1PlasticLinux/boost/1.58.0/boost/test/unit_test.hpp:19, from /store/prtc-rsfile/pc1/pc1PlasticLinux/cpputils/code/unitTest/../include/cuBoostUnitTestHeaderInclude.h:20, from /store/prtc-rsfile/pc1/pc1PlasticLinux/cpputils/code/unitTest/src/run_tests.cpp:2: /store/prtc-rsfile/pc1/pc1PlasticLinux/boost/1.58.0/boost/test/unit_test_log.hpp:134:28: warning: âboost::unit_test::{anonymous}::unit_test_logâ defined but not used [-Wunused-variable] BOOST_TEST_SINGLETON_INST( unit_test_log ) ^ /store/prtc-rsfile/pc1/pc1PlasticLinux/boost/1.58.0/boost/test/utils/trivial_singleton.hpp:64:36: note: in definition of macro âBOOST_TEST_SINGLETON_INSTâ namespace { BOOST_JOIN( inst, _t)& inst = BOOST_JOIN( inst, _t)::instance(); } FYI - run_tests.cpp is exactly this: #define BOOST_TEST_MODULE cpputils_tests test #include "cuBoostUnitTestHeaderInclude.h"
[Bug c++/68669] -Wunused-variable is not correctly supressed by #pragmas
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68669 --- Comment #2 from Pavel Celba --- Created attachment 36893 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36893&action=edit Preprocessed run_tests.cpp Added the pre-processed run_tests.cpp
[Bug c++/103096] New: Compiling never ends (at least not in resonable time - less than 10 mins)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103096 Bug ID: 103096 Summary: Compiling never ends (at least not in resonable time - less than 10 mins) Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: pavel.celba at ricardo dot com Target Milestone: --- Code - file test.cpp: #include #include using namespace std; template int qHash(const T& a) { return qHash(std::pair(a, a)); } int main() { int a = 3; std::cout << qHash(a); } Run as normally: gcc test.cpp
[Bug libstdc++/103096] Compiling never ends (at least not in resonable time - less than 10 mins)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103096 --- Comment #2 from Pavel Celba --- But shouldn't the compiler end in all cases with some error? There should be a depth instantiation limit which is reached and compilation ended. No matter how non-sensible the input is. My input is quite sensible C++ code bug thing any amateur can easily do.