home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / gnu / gcc / help / 2581 < prev    next >
Encoding:
Text File  |  1992-11-22  |  2.8 KB  |  90 lines

  1. Newsgroups: gnu.gcc.help
  2. Path: sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!foxtrot.ccmrc.ucsb.edu!doug
  3. From: doug@foxtrot.ccmrc.ucsb.edu (Douglas Scott)
  4. Subject: Internal compiler error in gcc/g++ 2.2.2 -- bug report?
  5. Message-ID: <9211231806.AA04816@foxtrot.ccmrc.ucsb.edu>
  6. Sender: daemon@cis.ohio-state.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Mon, 23 Nov 1992 18:06:24 GMT
  10. Lines: 78
  11.  
  12. I have been compiling a large C++ program with gcc/g++
  13. 2.2.2 for many months.  Today when I attempted to
  14. recompile after making a few changes, I got the following
  15. error on one file: 
  16.  
  17.  
  18. g++ -O2  -Wall -Wno-import -Wno-unused -Winline -pipe  -Div2_6_compatible  
  19. -DUSE_IV_2_6 -DUSE_CUSTOM_NEW -I. -I/usr/include/g++ -I/usr/include/sys  -c  
  20. Data.c
  21. Data.c: In method `Data::Data (class Data*)':
  22. Data.c:714: internal error--unrecognizable insn:
  23. (insn 22 20 24 (set (mem/s:SI (plus:SI (reg/v:SI 28)
  24.                (const_int 8)))
  25.        (mem/s:SI (plus:SI (mem:SI (plus:SI (reg:SI 14)
  26.                        (const_int 12)))
  27.                (const_int 8)))) -1 (nil)
  28.    (nil))
  29. /usr/local/bin/gcc: Internal compiler error: program cc1plus got fatal signal 6
  30. *** Exit 1
  31. Stop.
  32.  
  33. Here is the code in question:
  34.  
  35. Data::Data(Data *d) : rep(d->rep), myState(d->myState) {
  36.         Init();
  37.         trash(d);      
  38.  
  39. }
  40.  
  41. The routine trash() takes as an argument a reference to a
  42. pointer to a class that is a base class of Data -- this way I
  43. can zero the pointer after deleting it within the
  44. routine.
  45.  
  46. I am guessing that because the argument is passed as
  47. reference to the pointer, the compiler is choking due to
  48. the fact that the argument pointer 'd' is a register
  49. variable .  G++ makes all argument variables register --
  50. is this standard C++ practice?
  51.  
  52. In another instance in which I attempted to pass a non-pointer
  53. register variable via a reference, I got a decent warning
  54. from the compiler.
  55.  
  56. This is clearly a bug:  the compiler should give the same
  57. warning for attempting to pass a register pointer as it
  58. does for attempting to pass a register variable.  When I
  59. attempted to duplicate this in a short program (using
  60. pointers to ints rather than pointers to classes) I got no
  61. errors at all: 
  62.  
  63.  
  64. typedef int * &intrefptr;       // typedef to avoid compiler troubles with args
  65.  
  66. void testit(intrefptr r) {
  67.         printf("%d\n", *r);
  68. }
  69.  
  70. void fun(int *ptr) {    // "ptr" is a register variable inside fun, if my theory is correct
  71.         testit(ptr);    // here, passing register pointer to int as reference
  72. }
  73.  
  74. main() {
  75.         int i = 20;
  76.         int *pi = &i;
  77.         fun(pi);
  78. }
  79.  
  80.  Strange...can anyone comment on this??
  81.  
  82. Thanks.
  83.  
  84. ---
  85. Douglas Scott                              (805)893-8352
  86. Center for Computer Music Research and Composition
  87. University of California, Santa Barbara
  88. Internet: (NeXTMail ok)   <doug@foxtrot.ccmrc.ucsb.edu>
  89.  
  90.