Compilling the code (File: division.cc) ------------8<------------8<------------8<------------8<----------- template<typename typ> void divA(typ p,typ d,typ& q,typ& r) { if (p<d) { q=0; r=p; return; } typ r1; typ q1; divA(p>>1,d,q1,r1); q=2*q1; r=2*r1; if (p&1)r++; while(r>=d) //max 2 times { q++; r-=d; } }
int main(unsigned argc,char* args[]) { unsigned p=127; unsigned d=3; unsigned q=0; unsigned r=0; divA<unsigned>(p,d,q,r); } ------------8<------------8<------------8<------------8<----------- using the command /home/buchmann/cvs/eo3s/htc/bin/g++ -O3 -c -o division.o division.cc results in division.cc: In function 'void divA(typ, typ, typ&, typ&) [with typ = unsigned int]': division.cc:15: internal compiler error: in make_decl_rtl, at varasm.c:867 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. g++ -v: Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/specs gcc version 2.95.1 19990816 (release) Remarks: ok with gcc-3.4.3 ok with -O0 -O1 -O2 Best regards Hans Buchmann -- Summary: recursive template call Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hans dot buchmann at fhso dot ch CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18914