This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/12463] New: Internal error on very deep template expansion


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12463

           Summary: Internal error on very deep template expansion
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gianni at mariani dot ws
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux

time g++ -ftemplate-depth-1000000 mmmin.cpp   -o mmmin
g++: Internal error: Killed (program cc1plus)
Please submit a full bug report.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
836.420u 9.300s 15:09.20 93.0%  0+0k 0+0io 6379pf+0w


g++ -ftemplate-depth-1000000 -Wreturn-type -W -Wpointer-arith -pipe -ggdb3
-fcheck-new -fPIC  -D_POSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS -D_REENTRANT
-DACE_HAS_AIO_CALLS -DBUILD_VERSION=0309300625-i686-uluru-gx86-gianni
-DBUILD_ARCH=gx86 -fnon-call-exceptions       -I ./ -I work.gx86 -I
/home/gianni/limbo/asmx/asprin/src/austria/code/        mmmin.cpp   -o mmmin
{standard input}: Assembler messages:
{standard input}:4615: Warning: end of file in string; inserted '"'
g++: Internal error: Killed (program cc1plus)
Please submit a full bug report.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make: *** [mmmin] Error 1


Reading specs from /usr/local/lib/gcc-lib/i386-redhat-linux/3.3.1/specs
Configured with: ../gcc-3.3.1/configure --prefix=/usr/local
--mandir=/usr/local/share/man --infodir=/usr/local/share/info --enable-shared
--enable-threads=posix --disable-checking --host=i386-redhat-linux
--with-system-zlib --enable-__cxa_atexit
Thread model: posix
gcc version 3.3.1

The code:

#include <iostream>

template <typename T, int N>
struct pow_n
{
    static const T value = pow_n<T, N-1>::value/2;
};

template <typename T>
struct pow_n<T, 0>
{
    static const T value = static_cast<T>( 1 );
};

template <typename T, int N, bool v> struct min_f;

template <typename T, int N>
struct min_f<T,N,true>
{
    static const T min_value = pow_n<T,N-1>::value;

    static const int min_exponent = N-1;
};

template <typename T, int N, bool v>
struct min_f : min_f<T, N+1, pow_n<T, N>::value/2 == static_cast<T>( 0 ) >
{
};

template<typename T>
struct min_limit
{
    static const int min_exponent = min_f<T,0,false>::min_exponent;
    static const T min_value = min_f<T,0,false>::min_value;

};

int main()
{
    std::cout << "Float\n";
    std::cout << min_limit< float >::min_exponent << "\n";
    std::cout << min_limit< float >::min_value << "\n";

    std::cout << "Double\n";
    std::cout << min_limit< double >::min_exponent << "\n";
    std::cout << min_limit< double >::min_value << "\n";

    std::cout << "Long Double\n";
    std::cout << min_limit< long double >::min_exponent << "\n";
    std::cout << min_limit< long double >::min_value << "\n";

}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]