[Bug c++/32350] New: Very high compile times for template code
The attached code takes 1m29s to compile on my machine with 4.2.0 in 64-bit mode, and takes 0.5s on 4.0.3 Using built-in specs. Target: x86_64-suse-linux Configured with: ../../gcc-4.2.0/configure --enable-languages=c,c++,fortran --prefix=/usr/local/products/gcc/4.2.0-pa-64 --with-gnu-as --with-as=/usr/local/products/gcc/binutils-2.17-64/bin/as --with-gnu-ld --with-ld=/usr/local/products/gcc/binutils-2.17-64/bin/ld --enable-threads=posix --enable-shared --enable-__cxa_atexit --with-gmp=/usr/local/products/gcc/gmp-4.2-64 --with-mpfr=/usr/local/products/gcc/mpfr-2.2.1-64 --enable-libstdcxx-allocator=pool x86_64-suse-linux Thread model: posix gcc version 4.2.0 monsterd09:/work/nova/2300> time /usr/local/products/gcc/4.2.0-pa-64/bin/g++ -O0 -I/work/nova/sts5/beta/src -I/work/ren/ren/src -I/work/ren/ren.ext/src -D_LARGEFILE64_SOURCE -ftemplate-depth-64 -pedantic-errors -Wall -Wno-unknown-pragmas -W -Woverloaded-virtual -fno-strict-aliasing -fsigned-char -Wno-long-long test_fixedpoint_case.C real1m29.184s user1m28.338s sys 0m0.204s -- Summary: Very high compile times for template code Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: georgeh at rentec dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32350
[Bug c++/32350] Very high compile times for template code
--- Comment #1 from georgeh at rentec dot com 2007-06-14 22:02 --- Created an attachment (id=13706) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13706&action=view) Preprocessed source -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32350
[Bug c++/24525] New: g++ fails to warn when converting UDT through double to int
g++-4.0.0 compiles the following code without warning, with both -Wconversion and -Wall turned on. Since it is converting the UDT into a double, then converting the double to an int, I believe it should warn exactly as it does in the case when the commented-out line is used in place of the direct assignment. monsterd07> g++ -Wall test.C monsterd07> ./a.out monsterd07> g++ --version g++ (GCC) 3.3.4 (pre 3.3.5 20040809) Copyright (C) 2003 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. (test.C) #include struct T { explicit T(int i): mV(i) {} operator double() const { return mV; } int mV; }; int main() { T t(5); int y = t; // int y = double(t); assert(y == 5); } -- Summary: g++ fails to warn when converting UDT through double to int Product: gcc Version: 3.3.4 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: georgeh at rentec dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24525
[Bug c++/43522] New: 4.4 regression: Attempts to instantiate unnecessary code
Code: --- template struct tester; template <> struct tester { enum { value = 1 }; }; template struct allow_double_instantiations { static const bool value = false; }; template class FixedPoint { static const bool allow_double_instantiations = false; typedef FixedPoint Self; public: FixedPoint(): mValue(0) {} //Default copy c'tor, assignment op valid & useful. Self &operator=(double const &d) { mValue = sizeof(tester); return *this; } int mValue; }; void foo(FixedPoint<4> &); int main() { FixedPoint<4> x; foo(x); return 0; } template <> FixedPoint<4> &FixedPoint<4>::operator=(double const &d) { mValue = int(d); return *this; } void foo(FixedPoint<4> &t) { t = 13.5; } - gcc 4.3.2 and earlier versions compile this without complaint; 4.4.3 dies with test_fixedpoint.C: In member function `FixedPoint& FixedPoint::operator=(const double&)': test_fixedpoint.C:21: error: invalid application of `sizeof' to incomplete type `tester' By my reading of the standard, the invalid definition of operator= should not be attempted to be instantiated until line 43, where the valid template specialization has been seen, and previous versions of g++ agree with me. Note that in the original code, line 21 was a BOOST_STATIC_ASSERT and produced the same result. -- Summary: 4.4 regression: Attempts to instantiate unnecessary code Product: gcc Version: 4.4.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: georgeh at rentec dot com GCC target triplet: i686-suse-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43522
[Bug c++/43522] 4.4 regression: Attempts to instantiate unnecessary code
--- Comment #1 from georgeh at rentec dot com 2010-03-25 18:07 --- g++ -v output -- apologies: Using built-in specs. Target: i686-suse-linux Configured with: ../../gcc-4.4.3/configure --enable-languages=c,c++,fortran --p refix=/usr/local/products/gcc/4.4.3-32 --with-gnu-as --with-as=/usr/local/produ cts/gcc/binutils-2.19-32/bin/as --with-gnu-ld --with-ld=/usr/local/products/gcc /binutils-2.19-32/bin/ld --enable-threads=posix --enable-shared --enable-__cxa_ atexit --with-gmp=/usr/local/products/gcc/gmp-4.2.4-32 --with-mpfr=/usr/local/p roducts/gcc/mpfr-2.3.2-32 --enable-libstdcxx-allocator=pool i686-suse-linux Thread model: posix gcc version 4.4.3 (GCC) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43522
[Bug c++/24525] g++ fails to warn when converting UDT through double to int
--- Comment #3 from georgeh at rentec dot com 2006-12-11 14:34 --- (In reply to comment #2) > > Is this what you wished? > Yes. -- georgeh at rentec dot com changed: What|Removed |Added Status|WAITING |RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24525