From owner-freebsd-current Tue Nov 12 23:45:16 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9720837B401 for ; Tue, 12 Nov 2002 23:45:07 -0800 (PST) Received: from web14105.mail.yahoo.com (web14105.mail.yahoo.com [216.136.172.135]) by mx1.FreeBSD.org (Postfix) with SMTP id 4430443E8A for ; Tue, 12 Nov 2002 23:45:07 -0800 (PST) (envelope-from galen_sampson@yahoo.com) Message-ID: <20021113074507.30655.qmail@web14105.mail.yahoo.com> Received: from [209.245.128.232] by web14105.mail.yahoo.com via HTTP; Tue, 12 Nov 2002 23:45:07 PST Date: Tue, 12 Nov 2002 23:45:07 -0800 (PST) From: Galen Sampson Subject: Internal Compiler Error (not from ports) To: current@freebsd.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="0-1283656024-1037173507=:30222" Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --0-1283656024-1037173507=:30222 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello all, After updating to -current sources last night I found that I can reproduce an internal compiler error with my own source code. I'm not sure if it is related to the internal compiler error people are having with the ports are not. the command: g++ -Wall -c btree.cpp generates the error (source code attached). To help track this down line 12 of btree.h is commented out. Uncommenting this line allows the compiler to produce a .o file. If anyone is interested I will be happy to build a debug g++ if someone will point me in the right direction to get that accomplished. If you need me to ident g++ or need more information feel free to ask. regards, Galen Sampson __________________________________________________ Do you Yahoo!? U2 on LAUNCH - Exclusive greatest hits videos http://launch.yahoo.com/u2 --0-1283656024-1037173507=:30222 Content-Type: text/plain; name="btree.h" Content-Description: btree.h Content-Disposition: inline; filename="btree.h" #ifndef BTREE_H #define BTREE_H #include #define N 7 template class BTree { private: class Node; // class KeyNode; class DataNode; Node *root; public: inline BTree(); inline ~BTree(); inline bool search(Key &, Element &) const; inline bool insert(Key &, Element &); inline bool remove(Key &, Element &); }; #endif --0-1283656024-1037173507=:30222 Content-Type: text/plain; name="btree.cpp" Content-Description: btree.cpp Content-Disposition: inline; filename="btree.cpp" #include "btree.h" /* BTree nested class Node definitions */ template class BTree::Node { public: Node *left; Node *right; inline Node(); virtual bool search(Key &, Element &) const = 0; virtual bool insert(Node * &, Node * &, Key &, Element &) = 0; virtual bool remove(Node * &, Node * &, Key &, Element &) = 0; protected: unsigned int numElements; }; /* Node funtion definitions */ template inline BTree::Node::Node() :left(NULL), right(NULL), numElements(0) { } /* KeyNode nested and inherited class definition */ template class BTree::KeyNode : BTree::Node { public: bool search(Key &, Element &) const; bool insert(Node * &, Node * &, Key &, Element &); //bool remove(Node * &, Node * &, Key &, Element &); private: class NodeItem { public: Key &k; BTree::Node *child; NodeItem *next; }; NodeItem *preHead; NodeItem *head; NodeItem *tail; NodeItem *splitPoint; KeyNode(Node *); inline NodeItem * _search(Key &k) const { /* preHead and head can _never_ be NULL; * For a KeyNode to exist at least two DataNodes must exist * * This means it is not necessary to check if preHead == NULL * and it is also not necessary to check if head == NULL */ if(k < head->k) return preHead; NodeItem *temp = head; while(temp->next != NULL && temp->next->k >= k) temp = temp->next; return temp; } }; template class BTree::DataNode : BTree::Node { public: inline DataNode(); bool search(Key &, Element &) const; bool insert(Node * &, Node * &, Key &, Element &); bool remove(Node * &, Node * &, Key &, Element &); private: class NodeItem { public: Key &k; Element &e; NodeItem *next; }; NodeItem *head; NodeItem *tail; NodeItem *splitPoint; DataNode(Node *); }; /* BTree function definitions */ template inline BTree::BTree() { root = new DataNode(); } template inline BTree::~BTree() { delete root; } template inline bool BTree::search(Key &k, Element &e) const { return root->search(k, e); } template inline bool BTree::insert(Key &k, Element &e) { Node *p = root; return root->insert(p, k, e); } template inline bool BTree::remove(Key &k, Element &e) { Node *p = root; return root->remove(p, k, e); } /* KeyNode function definitions */ template BTree::KeyNode::KeyNode(Node *l) :preHead(l->splitPoint), head(l->splitPoint->next), tail(l->tail) { numElements = l->numElements / 2; left = l; right = l->right, preHead->next = NULL; } template bool BTree::KeyNode::search(Key &k, Element &e) const { return _search(k)->child->search(k, e); } template bool BTree::KeyNode::insert(Node * &p, Node * &toAdd, Key &k, Element &e) { bool toReturn; NodeItem *temp = _search(k); Node *newNode = NULL; toReturn = temp->child->insert(p, newNode, k, e); if(newNode != NULL) { numElements++; if(temp == preHead) { preHead->next = head; head = preHead; preHead = new NodeItem(k, newNode, NULL); } else { temp->next = new NodeItem(k, newNode, temp->next); if(temp == tail) { tail = temp->next; } } } if(numElements > N) { Node *newRight = new KeyNode(this); if(right != NULL) { right->left = newRight; } right = newRight; if(p == this) { p = new KeyNode(this, newRight); } else { toAdd = newRight; } } return toReturn; } /* template bool BTree::KeyNode::remove(Node * &, Key &, Element &) { return true; } */ /* template inline BTree::KeyNode::NodeItem * BTree::KeyNode::_search(Key &k) const { /* preHead and head can _never_ be NULL; * For a KeyNode to exist at least two DataNodes must exist * * This means it is not necessary to check if preHead == NULL * and it is also not necessary to check if head == NULL */ /* if(k < head->k) return preHead; NodeItem *temp = head; while(temp->next != NULL && temp->next->k >= k) temp = temp->next; return temp; } */ /* DataNode function definitions */ template inline BTree::DataNode::DataNode() :head(NULL), tail(NULL) { } template BTree::DataNode::DataNode(Node *l) :head(l->splitPoint->next), tail(l->tail) { numElements = l->numElements / 2; left = l; right = l->right, preHead->next = NULL; } template bool BTree::DataNode::search(Key &k, Element &e) const { NodeItem *temp = head; while(temp != NULL && k != temp->k) temp = temp->next; if(temp == NULL) { return false; } e = temp->e; return true; } template bool BTree::DataNode::insert(Node * &p, Node * &toAdd, Key &k, Element &e) { bool toReturn; if(head == NULL) { head = new NodeItem(); head->k = k; head->e = e; head->next = NULL; } else { NodeItem *temp = head; while(temp->next != NULL && k <= temp->k) temp = temp->next; if(k == temp->k) { return false; } NodeItem *toInsert = new NodeItem(); toInsert->k = k; toInsert->e = e; if(temp == head) { toInsert->next = head; head = toInsert; } else if(temp == tail) { tail->next = toInsert; tail = toInsert; } else { toInsert->next = temp->next->next; temp->next = toInsert; } } toReturn = true; if(numElements > N) { Node *newRight = new DataNode(this); if(right != NULL) { right->left = newRight; } right = newRight; if(p == this) { p = new KeyNode(this, newRight); } else { toAdd = newRight; } } return toReturn; } --0-1283656024-1037173507=:30222-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message