🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #688

Internal compiler error in gcc/g++ 2.2.2 -- bug report?

#688
From: Douglas Scott
Date: Mon, 23 Nov 1992 18:06
77 lines
2920 bytes
I have been compiling a large C++ program with gcc/g++
2.2.2 for many months.  Today when I attempted to
recompile after making a few changes, I got the following
error on one file: 


g++ -O2  -Wall -Wno-import -Wno-unused -Winline -pipe  -Div2_6_compatible  
-DUSE_IV_2_6 -DUSE_CUSTOM_NEW -I. -I/usr/include/g++ -I/usr/include/sys  -c  
Data.c
Data.c: In method `Data::Data (class Data*)':
Data.c:714: internal error--unrecognizable insn:
(insn 22 20 24 (set (mem/s:SI (plus:SI (reg/v:SI 28)
               (const_int 8)))
       (mem/s:SI (plus:SI (mem:SI (plus:SI (reg:SI 14)
                       (const_int 12)))
               (const_int 8)))) -1 (nil)
   (nil))
/usr/local/bin/gcc: Internal compiler error: program cc1plus got fatal signal 6
*** Exit 1
Stop.

Here is the code in question:

Data::Data(Data *d) : rep(d->rep), myState(d->myState) {
        Init();
        trash(d);      

}

The routine trash() takes as an argument a reference to a
pointer to a class that is a base class of Data -- this way I
can zero the pointer after deleting it within the
routine.

I am guessing that because the argument is passed as
reference to the pointer, the compiler is choking due to
the fact that the argument pointer 'd' is a register
variable .  G++ makes all argument variables register --
is this standard C++ practice?

In another instance in which I attempted to pass a non-pointer
register variable via a reference, I got a decent warning
from the compiler.

This is clearly a bug:  the compiler should give the same
warning for attempting to pass a register pointer as it
does for attempting to pass a register variable.  When I
attempted to duplicate this in a short program (using
pointers to ints rather than pointers to classes) I got no
errors at all: 


typedef int * &intrefptr;       // typedef to avoid compiler troubles with args

void testit(intrefptr r) {
        printf("%d\n", *r);
}

void fun(int *ptr) {	// "ptr" is a register variable inside fun, if my theory is correct
        testit(ptr);	// here, passing register pointer to int as reference
}

main() {
        int i = 20;
        int *pi = &i;
        fun(pi);
}

 Strange...can anyone comment on this??

Thanks.

---
Douglas Scott                              (805)893-8352
Center for Computer Music Research and Composition
University of California, Santa Barbara
Internet: (NeXTMail ok)   <doug@foxtrot.ccmrc.ucsb.edu>
Technical Details
Message-ID: <9211231806.AA04816@foxtrot.ccmrc.ucsb.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!foxtrot.ccmrc.ucsb.edu!doug

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!foxtrot.ccmrc.ucsb.edu!doug
From: doug@foxtrot.ccmrc.ucsb.edu (Douglas Scott)
Subject: Internal compiler error in gcc/g++ 2.2.2 -- bug report?
Message-ID: <9211231806.AA04816@foxtrot.ccmrc.ucsb.edu>
Sender: daemon@cis.ohio-state.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 23 Nov 1992 18:06:24 GMT
Lines: 78