User account creation filtered due to spam.

Bug 6620 - partial template specialization on int
Summary: partial template specialization on int
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.0
: P3 normal
Target Milestone: ---
Assignee: Kriang Lerdsuwanakij
Depends on:
Reported: 2002-05-09 20:06 UTC by jototland
Modified: 2003-07-25 17:33 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed:

Attachments (145 bytes, application/octet-stream)
2003-05-21 15:16 UTC, jototland

Note You need to log in before you can comment on or make changes to this bug.
Description jototland 2002-05-09 20:06:01 UTC
The attached source-file gives an internal compiler error when compiled with g++.

jo@bogon:~/units$ g++ -v -c
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs
gcc version 2.95.4 20011002 (Debian prerelease)
 /usr/lib/gcc-lib/i386-linux/2.95.4/cpp0 -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__ -Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ /tmp/ccnsOHUh.ii
GNU CPP version 2.95.4 20011002 (Debian prerelease) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
End of search list.
The following default directories have been omitted from the search path:
End of omitted list.
 /usr/lib/gcc-lib/i386-linux/2.95.4/cc1plus /tmp/ccnsOHUh.ii -quiet -dumpbase -version -o /tmp/ccrc1m4k.s
GNU C++ version 2.95.4 20011002 (Debian prerelease) (i386-linux) compiled by GNU C version 2.95.4 20011002 (Debian prerelease). Internal compiler error. Please submit a full bug report. Internal compiler error: See <URL:> for instructions.

jo@bogon:~/units$ g++-3.0 -v -c
Reading specs from /usr/lib/gcc-lib/i386-linux/3.0.4/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
Thread model: posix
gcc version 3.0.4
 /usr/lib/gcc-lib/i386-linux/3.0.4/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=4 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i386__ -D__GNUG__=3 -D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpbase -version -o /tmp/cc4oFYdd.s
GNU CPP version 3.0.4 (cpplib) (i386 Linux/ELF)
GNU C++ version 3.0.4 (i386-linux)
        compiled by GNU C version 3.0.4.
ignoring nonexistent directory "/usr/i386-linux/include"
#include "..." search starts here:
#include <...> search starts here:
End of search list. Internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:> for instructions.

g++ 3.04, g++ 2.95.4

Debian unstable, linux kernel 2.4.18

Compile the attached test-program
Comment 1 jototland 2002-05-09 20:06:01 UTC
No idea
Comment 2 Kriang Lerdsuwanakij 2002-05-10 09:32:06 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed.  Still present in trunk and 3.1 branch.
Comment 3 Volker Reichelt 2002-05-13 12:37:15 UTC
From: Reichelt <>
Subject: Re: c++/6620: partial template specialization on int
Date: Mon, 13 May 2002 12:37:15 +0200

 on can reduce the testcase a little more:
 --------------------------snip here-------------------------------
 template <int N> struct HoldInt {};
 template <class A, class B> struct Add;
 template <int N, int M> struct Add< HoldInt<N>, HoldInt<M> > {};
 template <int N>        struct Add< HoldInt<N>, HoldInt<-N> > {};
 Add< HoldInt<1>, HoldInt<-1> > a;
 --------------------------snip here-------------------------------
 By the way, both testcases not only crash gcc but even SGI's native
 compiler, so they seem to be a real compiler-killers ;-)
 Volker Reichelt
Comment 4 Kriang Lerdsuwanakij 2002-05-15 08:26:41 UTC
Responsible-Changed-From-To: unassigned->lerdsuwa
Responsible-Changed-Why: Patch submitted.
Comment 5 Kriang Lerdsuwanakij 2002-05-16 07:01:28 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed in the main trunk.  It won't be fixed in 3.1 branch 
    as stability is the main focus there.