home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / os / os2 / programm / 3936 < prev    next >
Encoding:
Text File  |  1992-07-31  |  4.6 KB  |  185 lines

  1. Newsgroups: comp.os.os2.programmer
  2. Path: sparky!uunet!gatech!psuvax1!uxa.ecn.bgu.edu!garrot.DMI.USherb.CA!lavog00
  3. From: lavog00@DMI.USherb.CA (GUYLAIN LAVOIE)
  4. Subject: GCC internal fatal error, cc1plus got a fatal signal 6???
  5. Message-ID: <Bs8tCD.H96@DMI.USherb.CA>
  6. Sender: usenet@DMI.USherb.CA (Pour courrier Usenet)
  7. Nntp-Posting-Host: tohi
  8. Organization: Universite de Sherbrooke -- departement de Mathematiques et d'Informatique
  9. Date: Fri, 31 Jul 1992 07:41:00 GMT
  10. Lines: 173
  11.  
  12. Hi all, I or should I say GCC 2.1 has a BIG problem!!!
  13.  
  14. Gcc is usually working fine but now! ho boy!
  15.  
  16. the compiler is returning this error!
  17.  
  18. c:\projet\glgraph>gcc -c linklist.cc
  19. cp-class.c:2371: failed assertion `IDENTIFIER_TEMPLATE (t) != NULL_TREE'
  20. GCC: internal compiler error: program cc1plus got fatal signal 6
  21.  
  22. with these files
  23.  
  24. * NOTE: This code is not mine, it's MR. X's (Don't know, sorry MR. X) files
  25.  
  26.  
  27. ========== CUT HERE linklist.cc ===========
  28.  
  29. // -------------- linklist.cc
  30.  
  31. #include <string.h>
  32. #include "linklist.h"
  33.  
  34. // ------- linked list destructor
  35. LinkedList::~LinkedList(void)
  36. {
  37.     ListEntry *thisentry = FirstEntry;
  38.  
  39.     while (thisentry != NULL)    {
  40.         delete thisentry->entrydata;
  41.         ListEntry *hold = thisentry;
  42.         thisentry = thisentry->NextEntry;
  43.         delete hold;
  44.     }
  45. }
  46.  
  47. // --------- add an entry to the list
  48. void LinkedList::addentry(void *newentry, int size)
  49. {
  50.     /* ------- build the new entry ------- */
  51.     ListEntry *thisentry = new ListEntry;
  52.     thisentry->entrydata = new char[size];
  53.     memcpy(thisentry->entrydata, newentry, size);
  54.  
  55.     if (CurrEntry == NULL)    {
  56.         thisentry->PrevEntry = NULL;
  57.         // ---- adding to the beginning of the list 
  58.         if (FirstEntry != NULL)    {
  59.             /* ---- already entries in this list ---- */
  60.             thisentry->NextEntry = FirstEntry;
  61.             FirstEntry->PrevEntry = thisentry;
  62.         }
  63.         else    {
  64.             // ----- adding to an empty list 
  65.             thisentry->NextEntry = NULL;
  66.             LastEntry = thisentry;
  67.         }
  68.         FirstEntry = thisentry;
  69.     }
  70.     else    {
  71.         // ------- inserting into the list 
  72.         thisentry->NextEntry = CurrEntry->NextEntry;
  73.         thisentry->PrevEntry = CurrEntry;
  74.         if (CurrEntry == LastEntry)
  75.             // ---- adding to the end of the list 
  76.             LastEntry = thisentry;
  77.         else
  78.             // ---- inserting between existing entries 
  79.             CurrEntry->NextEntry->PrevEntry = thisentry;
  80.         CurrEntry->NextEntry = thisentry;
  81.     }
  82.     CurrEntry = thisentry;
  83. }
  84.  
  85. // ---------- delete the current entry from the list
  86. void LinkedList::delete_entry(void)
  87. {
  88.     if (CurrEntry != NULL)    {
  89.         if (CurrEntry->NextEntry != NULL)
  90.             CurrEntry->NextEntry->PrevEntry = CurrEntry->PrevEntry;
  91.         else
  92.             LastEntry = CurrEntry->PrevEntry;
  93.         if (CurrEntry->PrevEntry != NULL)
  94.             CurrEntry->PrevEntry->NextEntry = CurrEntry->NextEntry;
  95.         else
  96.             FirstEntry = CurrEntry->NextEntry;
  97.         delete CurrEntry->entrydata;
  98.         ListEntry *hold = CurrEntry->NextEntry;
  99.         delete CurrEntry;
  100.         CurrEntry = hold;
  101.     }
  102. }
  103.  
  104. // ---- get the first entry in the list
  105. void *LinkedList::getfirst(void)
  106. {
  107.     CurrEntry = FirstEntry;
  108.     return CurrEntry == NULL ? NULL : CurrEntry->entrydata;
  109. }
  110.  
  111. // ---- get the next entry in the list
  112. void *LinkedList::getnext(void)
  113. {
  114.     if (CurrEntry == NULL)
  115.         CurrEntry = FirstEntry;
  116.     else
  117.         CurrEntry = CurrEntry->NextEntry;
  118.     return CurrEntry == NULL ? NULL : CurrEntry->entrydata;
  119. }
  120.  
  121. // ---- get the previous entry in the list
  122. void *LinkedList::getprev(void)
  123. {
  124.     if (CurrEntry == NULL)
  125.         CurrEntry = LastEntry;
  126.     else
  127.         CurrEntry = CurrEntry->PrevEntry;
  128.     return CurrEntry == NULL ? NULL : CurrEntry->entrydata;
  129. }
  130.  
  131. // ---- get the last entry in the list
  132. void *LinkedList::getlast(void)
  133. {
  134.     CurrEntry = LastEntry;
  135.     return CurrEntry == NULL ? NULL : CurrEntry->entrydata;
  136. }
  137. #ifndef LINKLIST
  138. #define LINKLIST
  139.  
  140. ============ END linklist.cc ==============
  141.  
  142. ============ CUT HERE linklist.h ==============
  143.  
  144. #include <stdio.h>
  145.  
  146. class LinkedList {
  147.     typedef struct list_entry    {
  148.         struct list_entry *NextEntry;
  149.         struct list_entry *PrevEntry;
  150.         void *entrydata;
  151.     } ListEntry;
  152.     ListEntry *FirstEntry;
  153.     ListEntry *LastEntry;
  154.     ListEntry *CurrEntry;
  155. public:
  156.     // ---- constructor
  157.     LinkedList(void)
  158.         { FirstEntry = LastEntry = CurrEntry = NULL; }
  159.     // ---- destructor
  160.     ~LinkedList(void);
  161.     // ---- add an entry
  162.     void addentry(void *newentry, int size);
  163.     // ---- delete the current entry
  164.     void delete_entry(void);
  165.     // ---- get the first entry in the list
  166.     void *getfirst(void);
  167.     // ---- get the next entry in the list
  168.     void *getnext(void);
  169.     // ---- get the previous entry in the list
  170.     void *getprev(void);
  171.     // ---- get the last entry in the list
  172.     void *getlast(void);
  173.     // ---- get the current entry in the list
  174.     void *getcurr(void)
  175.         {return CurrEntry==NULL ? NULL : CurrEntry->entrydata;}
  176. };
  177.  
  178. #endif
  179.  
  180. ============= END linklist.h ==============
  181. Thanks...
  182. Guylain Lavoie
  183. LAVOG00@DMI.USherb.CA
  184.  
  185.