[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#376148: g++-4.1: ICE with this 20 lines long code



Package: g++-4.1
Version: 4.1.1-5
Severity: normal

Hello!

$ cat templ_templ.cpp

template<typename T> struct size_traits;
template<typename T, unsigned N> struct same_size_p;

template<typename T1> struct foo {
	static const unsigned N_BC = size_traits<T1>::Size;

	template<typename T2, unsigned N, 
		bool pred = same_size_p<T2, N_BC>::value > struct bar;
	template<typename T2, unsigned N> struct bar<T2, N, true> {
		static void apply(const T1& x, T2& y) { }
	};

	template<typename T3> void operator()(T1& a, T3& b) {
		bar<T3, N_BC>::apply(a, b); // will get an ICE here
		// Here is a work-around:
		//bar<T3, N_BC, same_size_p<T3, N_BC>::value>::apply(a, b);
	}
};

$ g++-4.1 -O0 -g -c templ_templ.cpp
templ_templ.cpp: In member function ‘void foo<T1>::operator()(T1&, T3&)’:
templ_templ.cpp:14: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see <URL:file:///usr/share/doc/gcc-4.1/README.Bugs>.
Preprocessed source stored into /tmp/user/1000/ccCgKoSV.out file, please attach this to your bugreport.

Note that g++-4.0 and gcc-snapshot are affected too.

Best regards,
  Alexei.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/dash
Kernel: Linux 2.4.32-grsec-acl-hf32.6-i686-smp
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)

Versions of packages g++-4.1 depends on:
ii  gcc-4.1                       4.1.1-5    The GNU C compiler
ii  gcc-4.1-base                  4.1.1-5    The GNU Compiler Collection (base 
ii  libc6                         2.3.6-15   GNU C Library: Shared libraries
ii  libstdc++6-4.1-dev            4.1.1-5    The GNU Standard C++ Library v3 (d

g++-4.1 recommends no packages.

-- no debconf information

-- 
All science is either physics or stamp collecting.

Attachment: signature.asc
Description: Digital signature


Reply to: