[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-bugs
Subject:    Internal Error in gcc 2.91.66
From:       Arkadiy Belousov <abelousov () netops ! com>
Date:       2000-07-31 16:37:47
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


I've got the following output from my make file:

g++ -g -c -Wall   -DGMP  -DLINUX -D_REENTRANT  -I. -I../../src/msgs
-I../../src/snmp -I../../src/src2 -I../../src/utils -I../../src/shared
-I../../src/include -I../../src/winport -I../../src/regex
-I../../src/gmp -I../../src/zlib -I../../src/zlib/rh -DGMP  -DLINUX
-D_REENTRANT  -D__need_ptrdiff_t -D__need_timespec -D_REENTRANT
-D__STL_USE_NEWALLOC -D__STL_NO_OWN_NAMESPACE
-D__STL_HAS_NO_NEW_C_HEADERS -D__STL_NO_NAMESPACES -I../../src/STL   -o
mibtree.o mibtree.cpp
mibtree.cpp:48: Internal compiler error.
mibtree.cpp:48: Please submit a full bug report to
`egcs-bugs@egcs.cygnus.com'.
mibtree.cpp:48: See <URL:http://egcs.cygnus.com/faq.html#bugreport> for
details.


There is a syntax error at line 48, but it's not a reason to give
"Internal Error", is it?


The --version gives the following:

egcs-2.91.66

So there :) Enjoy!

Attached is the source file (there is a syntax error at line 48, indeed)
and the gzipped .ii file





--
A cynic is a man who, when he smells flowers, looks around for a coffin.



[Attachment #5 (text/html)]

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
I've got the following output from my make file:
<br>&nbsp;
<br>g++ -g -c -Wall&nbsp;&nbsp; -DGMP&nbsp; -DLINUX -D_REENTRANT&nbsp;
-I. -I../../src/msgs -I../../src/snmp -I../../src/src2 -I../../src/utils
-I../../src/shared -I../../src/include -I../../src/winport -I../../src/regex
-I../../src/gmp -I../../src/zlib -I../../src/zlib/rh -DGMP&nbsp; -DLINUX
-D_REENTRANT&nbsp; -D__need_ptrdiff_t -D__need_timespec -D_REENTRANT \
                -D__STL_USE_NEWALLOC
-D__STL_NO_OWN_NAMESPACE -D__STL_HAS_NO_NEW_C_HEADERS -D__STL_NO_NAMESPACES
-I../../src/STL&nbsp;&nbsp; -o mibtree.o mibtree.cpp
<br>mibtree.cpp:48: Internal compiler error.
<br>mibtree.cpp:48: Please submit a full bug report to `egcs-bugs@egcs.cygnus.com'.
<br>mibtree.cpp:48: See &lt;URL:<A \
HREF="http://egcs.cygnus.com/faq.html#bugreport">http://egcs.cygnus.com/faq.html#bugreport</A>>
 for details.
<br>&nbsp;
<p>There is a syntax error at line 48, but it's not a reason to give "Internal
Error", is it?
<br>&nbsp;
<p>The --version gives the following:
<p>egcs-2.91.66
<p>So there :) Enjoy!
<p>Attached is the source file (there is a syntax error at line 48, indeed)
and the gzipped .ii file
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<pre>--&nbsp;
A cynic is a man who, when he smells flowers, looks around for a coffin.</pre>
&nbsp;</html>


["mibtree.cpp" (text/plain)]

#include "pdu.h"
#include "bssert.h"
#include <map>






class MibTreeNode
{
public:
  virtual ~MibTreeNode(){};

  /* leaf interface */
public:
  /* return NULL when value is not set or it's an internal node */
  virtual const PduElement *GetValue(){ASSERT(0);return NULL;};

  /* internal node interface */
public: 
  /* replace child a this key with the given one */
  virtual void SetChild(int key, MibTreeNode *child){ASSERT(0);};
  /* add an internal child if there is nothing at the given key */
  virtual MibTreeNode *AddChild(int key){ASSERT(0);return NULL;};
  /* see function name. Return NULL if there is no child */
  virtual MibTreeNode *GetChild(int key){ASSERT(0);return NULL;};
  /* see function name */
  virtual int CountChildren(){ASSERT(0);return 0;};
};


class MibTreeInternalNode : public MibTreeNode
{
public:
  virtual void SetChild(int key, MibTreeNode *child);
  virtual MibTreeNode *AddChild(int key);
  virtual MibTreeNode *GetChild(int key);
  virtual int CountChildren(){return children.size();};
public:
  ~MibTreeInternalNode();
protected:
  typedef  map <int, MibTreeNode *, less<int> > ChildNodeCollection;
  ChildNodeCollection children;
}


MibTreeInternalNode::~MibTreeInternalNode()
{
  ChildNodeCollection::iterator i;
  for (i = children.begin(); i != children.end(); i++)
    if (*i != NULL) delete *i;
  children.clear();
}

void AddChild(int key)
{
  MibTreeNode *&location = children[key];

  /* if a child already exists, return it */
  if (location != NULL) return location;

  /* otherwise, add another internal mode and return the new addition */
  location = new MibTreeInternalNode;
  return location;
}


void SetChild(int key, MibTreeNode *child)
{
  MibTreeNode *&location = children[key];
  
  /* verify that compiler is not broken */
  ASSERT((MibTreeNode *)() == NULL);
  
  if (location != NULL) delete location;
  location = child;
}


MibTreeNode *GetChild(int key)
{
  MibTreeNode *&location = children[key];
  ASSERT(location != NULL);
  return location;
};


class MibTreeLeafNode : public MibTreeNode, PduElementWithData
{
public:
  MibTreeLeafNode(int t, size_t l, const void *v) : 
    PduElementWithData(v, l), data_type(t) {};
public:
  virtual const PduElement *GetValue(){return this;};
public:
  virtual char GetType(){return data_type;};
protected:
  int data_type;
}



class MibTree
{
public:
  const PduElement *GetValueForOid(size_t oid_l, const void *oid_v);
  void SetValueForOid(size_t oid_l, const void *oid_v, 
		      int t, size_t l, const void *v);
protected:
  MibTreeInternalNode mib_root;
};


const PduElement *MibTree::GetValueForOid(size_t oid_l, const void *oid_v)
{
  unsigned char *oid = (unsigned char *)oid_v;
  int part = 0;

  MibTreeNode *node = &mib_root;

  ASSERT(oid[0] == 43);
  oid++;
  oid_l--;

  for (unsigned int i = 0; i < oid_l; i ++) {
    unsigned char byte = oid[i];
    part <<= 7;
    part |= byte & 0x7F;

    if ((byte & 0x80) == 0) {
      /* end of part - go to the tree */
      node = node->GetChild(part);
      if (node == NULL)
	return NULL; /* no such OID */
    }
  }
  
  return node->GetValue();
}

void MibTree::SetValueForOid(size_t oid_l, const void *oid_v,
					  int t, size_t l, const void *v)
{
  unsigned char *oid = (unsigned char *)oid_v;
  int part = 0;

  MibTreeNode *node = &mib_root;

  ASSERT(oid[0] == 43);
  oid++;
  oid_l--;

  for (unsigned int i = 0; i < oid_l; i ++) {
    unsigned char byte = oid[i];
    part <<= 7;
    part |= byte & 0x7F;

    if ((byte & 0x80) == 0) {
      /* end of part - go to the tree */

      if (i == oid_l - 1) {
	/* the very last part - add as value */
	node->SetChild(part, new MibTreeLeafNode(t, l, v));
      } else {
	/* intermediate part - add as inside item */
      node = node->AddChild(part);
      if (node == NULL)
	return NULL; /* no such OID */
    }
  }
  
  return node->GetValue();
}



#if 0
class StoredSnmpValue : public PduElementWithData
{
public:
  StoredSnmpValue(): data_type(-1){};
  StoredSnmpValue(const StoredSnmpValue &pther): 
    PduElementWithStaticData(), dataType(-1){
    setValue(other.dataType, other.buf_size, other.data_buffer);};
  const StoredSnmpValue &operator =(const StoredSnmpValue &other) {
    setValue(other.data_type, other.buf_size, other.data_buffer);};

public:
  char GetType(){return dataType;};

public:
  setValue(int t, size_t l, const void *v){
    if (data != NULL) delete data;
    data_buffer = new char[l]; memcpy(data_buffer, v, l);
    dataType = t; buf_size = l; ASSERT(data_buffer != NULL || l == 0);
  }
protected:
  int dataType;
};

#endif

["mibtree.ii.gz" (application/x-gzip)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic