Bug 6620 - partial template specialization on int
partial template specialization on int
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: c++
3.0
: P3 normal
: ---
Assigned To: Kriang Lerdsuwanakij
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2002-05-09 20:06 UTC by jototland
Modified: 2003-07-25 17:33 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
minimal2.cc (300 bytes, application/octet-stream)
2003-05-21 15:16 UTC, jototland
Details

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 minimal2.cc
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__ minimal2.cc /tmp/ccnsOHUh.ii
GNU CPP version 2.95.4 20011002 (Debian prerelease) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3
 /usr/local/include
 /usr/lib/gcc-lib/i386-linux/2.95.4/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
 /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../i386-linux/include
End of omitted list.
 /usr/lib/gcc-lib/i386-linux/2.95.4/cc1plus /tmp/ccnsOHUh.ii -quiet -dumpbase minimal2.cc -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).
minimal2.cc:10: Internal compiler error.
minimal2.cc:10: Please submit a full bug report.
minimal2.cc:10: Internal compiler error:
minimal2.cc:10: See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.



jo@bogon:~/units$ g++-3.0 -v -c minimal2.cc
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__ minimal2.cc -D__GNUG__=3 -D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpbase minimal2.cc -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:
 /usr/include/g++-v3
 /usr/include/g++-v3/i386-linux
 /usr/include/g++-v3/backward
 /usr/local/include
 /usr/lib/gcc-lib/i386-linux/3.0.4/include
 /usr/include
End of search list.
minimal2.cc:10: Internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

Release:
g++ 3.04, g++ 2.95.4

Environment:
Debian unstable, linux kernel 2.4.18

How-To-Repeat:
Compile the attached test-program
Comment 1 jototland 2002-05-09 20:06:01 UTC
Fix:
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 <reichelt@igpm.rwth-aachen.de>
To: gcc-gnats@gcc.gnu.org, jototland@hotmail.com, gcc-bugs@gcc.gnu.org,
        nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/6620: partial template specialization on int
Date: Mon, 13 May 2002 12:37:15 +0200

 Hi,
 
 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 ;-)
 
 Greetings,
 Volker Reichelt
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6620
 
 
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.