STL bitset

Jeff Sparkes
Wed Jan 20 10:52:00 GMT 1999

Pasha Murat wrote:

> Dear  EGCS developers, I apologize for being nasty...
> here is another problem report : I'm trying to compile
> a simple code using STL bitset class (available in snapshots since recently)
> on SGI IRIX 6.2.
> - first, egcs can't find CHAR_BIT constant. this is easy and could be fixed
>   by including  <limits.h> (see source below,  could be SGI-specific problem)
> -  thee next problem is the real one ...  see egcs output below
>                         thanks for your time and effort, pasha
> --------------------------------------------------------------------------------
> /data69/upgrade/murat>cat  bugs/egcs/
> #include <limits.h>
> #include <bitset>
> class  A {
>   bitset<96>  mask;
> public:
>   A(){}
>   ~A(){}
>   void set_mask(int i) {mask[i] = 1; }
> };
> --------------------------------------------------------------------------------
> /data69/upgrade/murat>gcc -c -v bugs/egcs/
> Reading specs from /data69/upgrade/murat/egcs-19990103/lib/gcc-lib/mips-sgi-irix5.3/egcs-2.92.34/specs
> gcc version egcs-2.92.34 19990103 (gcc2 ss-980609 experimental)
>  /data69/upgrade/murat/egcs-19990103/lib/gcc-lib/mips-sgi-irix5.3/egcs-2.92.34/cpp -lang-c++ -v -isystem /data61/top/murat/bin/include -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=92 -Dunix -Dmips -Dsgi -Dhost_mips -DMIPSEB -D_MIPSEB -DSYSTYPE_SVR4 -D_SVR4_SOURCE -D_MODERN_C -D__DSO__ -D_MIPS_SIM=_MIPS_SIM_ABI32 -D_MIPS_SZPTR=32 -D__unix__ -D__mips__ -D__sgi__ -D__host_mips__ -D__MIPSEB__ -D_MIPSEB -D__SYSTYPE_SVR4__ -D_SVR4_SOURCE -D_MODERN_C -D__DSO__ -D_MIPS_SIM=_MIPS_SIM_ABI32 -D_MIPS_SZPTR=32 -D__unix -D__mips -D__sgi -D__host_mips -D__MIPSEB -D__SYSTYPE_SVR4 -Asystem(unix) -Asystem(svr4) -Acpu(mips) -Amachine(sgi) -D__EXCEPTIONS -D__CHAR_UNSIGNED__ -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS -D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int -D__EXTENSIONS__ -D_SGI_SOURCE -D_LONGLONG -D_MIPS_FPSET=16 -D_MIPS_ISA=_MIPS_ISA_MIPS1 -D_MIPS_SZINT=32 -D_MIPS_SZLONG=32 bugs/egcs/ /var/tmp/ccICsWEy.ii
> GNU CPP version egcs-2.92.34 19990103 (gcc2 ss-980609 experimental) [AL 1.1, MM 40] SGI running IRIX 5.x
> #include "..." search starts here:
> #include <...> search starts here:
>  /data69/upgrade/murat/egcs-19990103/include/g++-2
>  /data69/upgrade/murat/egcs-19990103/include
>  /data69/upgrade/murat/egcs-19990103/mips-sgi-irix5.3/include
>  /data69/upgrade/murat/egcs-19990103/lib/gcc-lib/mips-sgi-irix5.3/egcs-2.92.34/include
>  /usr/include
> End of search list.
>  /data69/upgrade/murat/egcs-19990103/lib/gcc-lib/mips-sgi-irix5.3/egcs-2.92.34/cc1plus /var/tmp/ccICsWEy.ii -quiet -dumpbase -version -o /var/tmp/ccaGL6i3.s
> GNU C++ version egcs-2.92.34 19990103 (gcc2 ss-980609 experimental) (mips-sgi-irix5.3) compiled by GNU C version egcs-2.92.34 19990103 (gcc2 ss-980609 experimental).
> /data69/upgrade/murat/egcs-19990103/include/g++-2/bitset: In method `bitset<96,long unsigned int>::reference::reference(class bitset<96,long unsigned int> &, unsigned int)':
> /data69/upgrade/murat/egcs-19990103/include/g++-2/bitset:751:   instantiated from `bitset<96,long unsigned int>::operator [](unsigned int)'
> bugs/egcs/   instantiated from here
> /data69/upgrade/murat/egcs-19990103/include/g++-2/bitset:91: `long unsigned int & _Base_bitset<3,long unsigned int>::_M_getword(unsigned int)' is from private base class
> /data69/upgrade/murat/egcs-19990103/include/g++-2/bitset:581: within this context
> --------------------------------------------------------------------------------

You can get this to work by adding "public:" just before line 541.  I suspect that
the name which are imported there are not getting the access rights exactly the same as if they were defined there.  I looked at the code, but couldn't see anything obvious.  It would have to be pretty obvious for me to find it. :-)

With that one change, I'm able to use bitset without problems.  It's obviously just a workaround.  I'm going to put together a more detailed bug report someday...

More information about the Gcc-bugs mailing list