[Bug c++/33962] New: ICE at call to overloaded template function with variable-length function argument list

rjpeters at klab dot caltech dot edu gcc-bugzilla@gcc.gnu.org
Wed Oct 31 19:20:00 GMT 2007


I ran across this ICE while compiling some old code that used to compile
cleanly with at least gcc 3.3.x and maybe 3.4.x. Looks like this ICE occurs in
a number of 4.x versions including 4.0.1 (Darwin), 4.1.1 (Mandriva Cooker
2007), 4.1.2 (Fedora Core 7), as well as current 4.3.0 mainline from svn.

$ /home/tmp/u/rjpeters/gcc-svn-install/bin/g++ -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: /home/tmp/u/rjpeters/gcc-svn/configure
--prefix=/home/tmp/u/rjpeters/gcc-svn-install --enable-shared
--enable-threads=posix --with-system-zlib --enable-__cxa_atexit
--enable-languages=c,c++ --enable-long-long --enable-checking
--with-gmp=/home/tmp/u/rjpeters/gmp-4.2.1-install
--with-mpfr=/home/tmp/u/rjpeters/mpfr-2.2.1-install
Thread model: posix
gcc version 4.3.0 20071031 (experimental) [trunk revision 129804] (GCC)


$ cat bug.C
template <class T> struct A;

template <class U> void foo(const U& x, ...);
template <class T> void foo(const A<T>& x, ...);

void bar(const A<int>& x, const char* y)
{
  foo(x, y); // <--- ICE occurs here
}

$ /home/tmp/u/rjpeters/gcc-svn-install/bin/g++ -c bug.C
bug.C: In function ‘void bar(const A<int>&, const char*)’:
bug.C:8: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

The code compiles cleanly when either the '...' is replaced with 'const char*',
or when one of the function overloads is removed.


Other compiler versions that give the same ICE:

$ g++ -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-cpu=generic
--host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20070502 (Red Hat 4.1.2-12)


$ g++ -v
Using built-in specs.
Target: x86_64-mandriva-linux-gnu
Configured with: ../configure --prefix=/usr --libexecdir=/usr/lib
--with-slibdir=/lib64 --mandir=/usr/share/man --infodir=/usr/share/info
--enable-shared --enable-threads=posix --enable-checking=release
--enable-languages=c,c++,ada,fortran,objc,obj-c++,java
--host=x86_64-mandriva-linux-gnu --with-cpu=generic --with-system-zlib
--enable-long-long --enable-__cxa_atexit --enable-clocale=gnu
--disable-libunwind-exceptions --enable-java-awt=gtk
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --enable-gtk-cairo
--enable-ssp --disable-libssp
Thread model: posix
gcc version 4.1.1 20060724 (prerelease) (4.1.1-3mdk)


$ g++ -v
Using built-in specs.
Target: i686-apple-darwin8
Configured with: /private/var/tmp/gcc/gcc-5363.obj~28/src/configure
--disable-checking -enable-werror --prefix=/usr --mandir=/share/man
--enable-languages=c,objc,c++,obj-c++
--program-transform-name=/^[cg][^.-]*$/s/$/-4.0/
--with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib
--build=powerpc-apple-darwin8 --with-arch=nocona --with-tune=generic
--program-prefix= --host=i686-apple-darwin8 --target=i686-apple-darwin8
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5363)


Thanks,
Rob Peters


-- 
           Summary: ICE at call to overloaded template function with
                    variable-length function argument list
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rjpeters at klab dot caltech dot edu
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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



More information about the Gcc-bugs mailing list