This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

egc1.1 bogus bitfield error message


The code below produced a bogus error message about trying to take the
address of a bitfield.  The code below is a .h file from a much larger
application.  Unfortunately, when I tried to whittle the code down in
order to produce a small fragment to send you, the bogus message went
away!  But I'm hoping that you will be able to nail this even though I'm
only sending you this one .h file.  (The offending line 59 in my code is
indicated by a comment.  If you need the entire application, I can send
you a gzipped tar file, approximately 1M).

Thanks,
Steve Vavasis

---------------------- bogus error message

syn.cs.cornell.edu> /usr/local/gnu/egcs-1.1b/bin/g++ -I. -g -c -v 
-I../../src/common/ -I../../src/tcl/ -DDEBUGGING -DEXCEPTIONS_ENABLED
-DUSE_SSTREAM -I../../src/meshgen/ ../../src/meshgen/align.cpp
/usr/local/gnu/egcs-1.1b/bin/g++ -I. -g -c -v  -I../../src/common/
-I../../src/tcl/ -DDEBUGGING -DEXCEPTIONS_ENABLED -DUSE_SSTREAM
-I../../src/meshgen/ ../../src/meshgen/align.cpp

Reading specs from
/usr/local/gnu/egcs-1.1b/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.91.57/specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)

/usr/local/gnu/egcs-1.1b/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.91.57/cpp
-lang-c++ -v -I. -I../../src/common/ -I../../src/tcl/
-I../../src/meshgen/ -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus
-D__GNUC_MINOR__=91 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__
-D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix
-Asystem(unix) -Asystem(svr4) -D__EXCEPTIONS -g -D__GCC_NEW_VARARGS__
-Acpu(sparc) -Amachine(sparc) -DDEBUGGING -DEXCEPTIONS_ENABLED
-DUSE_SSTREAM ../../src/meshgen/align.cpp /var/tmp/cco2t0ut.ii
GNU CPP version egcs-2.91.57 19980901 (egcs-1.1 release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 .
 ../../src/common
 ../../src/tcl
 ../../src/meshgen
 /usr/local/gnu/egcs-1.1b/include/g++
 /usr/local/include
 /usr/local/gnu/egcs-1.1b/sparc-sun-solaris2.5/include

/usr/local/gnu/egcs-1.1b/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.91.57/include
 /usr/include
End of search list.

/usr/local/gnu/egcs-1.1b/lib/gcc-lib/sparc-sun-solaris2.5/egcs-2.91.57/cc1plus
/var/tmp/cco2t0ut.ii -quiet -dumpbase align.cc -g -version -o
/var/tmp/cc4SEgJs.s
GNU C++ version egcs-2.91.57 19980901 (egcs-1.1 release)
(sparc-sun-solaris2.5) compiled by GNU C version egcs-2.91.57 19980901
(egcs-1.1 release).
../../src/meshgen/qbfdag.h: In method `int
::QMG::MG::BoxFaceDag::DagNode::vertex_index() const':
In file included from ../../src/meshgen/qboxstack.h:24,
                 from ../../src/meshgen/align.cpp:23:
../../src/meshgen/qbfdag.h:59: attempt to take address of bit-field
structure member `nodetype_'
../../src/meshgen/qbfdag.h:59: cannot convert `{error}' from type
`{error}' to type `const ::QMG::MG::BoxFaceDag::DagNode::NodeType *'
../../src/meshgen/qbfdag.h: In method `int
::QMG::MG::BoxFaceDag::DagNode::parent2() const':
../../src/meshgen/qbfdag.h:74: attempt to take address of bit-field
structure member `nodetype_'
../../src/meshgen/qbfdag.h:74: cannot convert `{error}' from type
`{error}' to type `const ::QMG::MG::BoxFaceDag::DagNode::NodeType *'

----------------------------- qbfdag.h
// ------------------------------------------------------------------
// qbfdag.h
//
// This file contains a class for holding the dag (directed acyclic
// graph) on box faces.
// ------------------------------------------------------------------
// Author: Stephen A. Vavasis
// Copyright (c) 1998 by Cornell University.  All rights reserved.
// 
// See the accompanying file 'Copyright' for authorship information,
// the terms of the license governing this software, and disclaimers
// concerning this software.
// ------------------------------------------------------------------
// This file is part of the QMG software.  
// Version 2.0 of QMG, release date RELDATE.
// ------------------------------------------------------------------



#ifndef QBFDAG_H
#define QBFDAG_H



#include "qmgnamesp.h"
#include "qsimpcomp.h"
#include "qsmall.h"
#include "qmatvec.h"



class QMG::MG::BoxFaceDag {
public:
  typedef int Index; 

private:

  // The dag has two types of nodes, FACETNODE which is generated
  // when align launches a new facet of a box, and MERGENODE
  // when deduplicate_orbit merges two identical boxes.


  class DagNode {
  public:
    enum NodeType {FACETNODE, MERGENODE};
  private:
    Index parent1_;
    int second_data_;
    NodeType nodetype_ : 2;
    bool is_leaf_ : 1;
    unsigned int side1_ : 1;
    unsigned int side2_ : 1;
    unsigned int dim1_ : 3;
    unsigned int dim2_ : 3;
  public:
    NodeType linktype() const { return nodetype_; }
    SimpComplex::VertexIndex vertex_index() const {
#ifdef DEBUGGING
      if (nodetype_ != FACETNODE) {  // LINE 59 -- BOGUS EGCS ERROR HERE 
        throw_error("Invalid access to dag node 1");
      }
#endif
      return second_data_;
    }

    unsigned int side1() const { return side1_;}
    unsigned int dim1() const { return dim1_; }
    unsigned int side2() const { return side2_;}
    unsigned int dim2() const { return dim2_;}
    bool is_leaf() const { return is_leaf_; }
    Index parent1() const { return parent1_;}
    Index parent2() const {
#ifdef DEBUGGING
      if (nodetype_ != MERGENODE) {
        throw_error("Invalid access to dag node 2");
      }
#endif
      return second_data_;
    }
    DagNode() { }
    ~DagNode() { }
    void initialize_to_merge_node(Index par1, 
      unsigned int side1, 
      unsigned int dim1, 
      Index par2,
      unsigned int side2,
      unsigned int dim2) {
      parent1_ = par1;
      second_data_ = par2;
      dim1_ = dim1;
      dim2_ = dim2;
      side1_ = side1;
      side2_ = side2;
      is_leaf_ = false;
      nodetype_ = MERGENODE;
    }

    void initialize_to_facet_node(int par1,
      int side1,
      int dim1,
      SimpComplex::VertexIndex vnum,
      bool is_leaf1) {
      parent1_ = par1;
      side1_ = side1;
      dim1_ = dim1;
      second_data_ = vnum;
      is_leaf_ = is_leaf1;
      nodetype_ = FACETNODE;
    }
  };
  static DagNode nullnode;

private:
  int di_;
  vector<DagNode> linkstack_;
  BoxFaceDag(const BoxFaceDag&) { }
  void operator=(const BoxFaceDag&) { }
public:
  Index add_protected_box(const ActiveBox& b, SimpComplex::VertexIndex
vnum);
  Index add_merge_node(Index par1, 
    unsigned int side1, 
    unsigned int dim1,
    Index par2,
    unsigned int side2,
    unsigned int dim2) {
    Index sz = linkstack_.size();
    linkstack_.resize(sz + 1, nullnode);
    linkstack_.back().initialize_to_merge_node(par1, side1, dim1, par2,
side2, dim2);
    return sz;
  }

  // Data is retrieved from the dag by looping over ancestors.
  // In particular, a leaf node is selected, then Loop_over_ancestors
  // traces all possible paths to root boxes.  Root boxes are the
  // full-dimensional boxes in the dag.

  class Loop_over_ancestors;
  friend class Loop_over_ancestors;
  bool is_leaf(Index ind) const {return linkstack_[ind].is_leaf();}
  int size() const {return linkstack_.size();}
  explicit BoxFaceDag(int di) : di_(di) { }
  ~BoxFaceDag() { }
};



class QMG::MG::BoxFaceDag::Loop_over_ancestors {
private:
  void trace_path_to_root(Index starting_link, 
    bool second_setting);
  int di;
  vector<Index> dfs_link_index;
  const vector<DagNode>& linkstack;
  Index prev_link;
  StatVector<SimpComplex::VertexIndex, MAXDIM + 1> simp_vertex_;
  StatVector<SimpComplex::VertexIndex, MAXDIM + 1> simp_vertex_o_;
  int vcount_;
  bool prev_second_setting;
  StatVector<int, MAXDIM + 1> side;
  StatVector<int, MAXDIM + 1> permut;
  vector<My_bool> dfs_second_flag;
  bool done_;
  StatVector<int, MAXDIM + 1> wksp;

public:
  int vcount() const { return vcount_; }
  const StatVector<SimpComplex::VertexIndex, MAXDIM + 1>& simp_vertex()
const {
    return simp_vertex_o_;
  }
  SimpComplex::VertexIndex simp_vertex(int i) const {
#ifdef RANGECHECK
    if (i < 0 || i >= di) {
      throw_error("Out of range in simp_vertex");
    }
#endif
    return simp_vertex_o_[i];
  }
  Loop_over_ancestors(const BoxFaceDag& dag,  
    Index linkstart);
  explicit Loop_over_ancestors(const BoxFaceDag& dag);
  void restart(Index linkstart);
  ~Loop_over_ancestors() { }
  void operator++();
  bool notdone() const;
};






#endif


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]