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]

A couple more bugs in egcs-1.0.2 ...


Here are two more bug reports for egcs-1.0.2, along with another gripe
about warning messages from the c++ library classes.

Bug report 1:
======================================================================

Here's an interesting little compiler error (obviously, the parser is
getting stuck and doesn't know why).  Here's the example:


======================== Test.cpp ================================
#include <unistd.h>
#include <iostream>
#include <deque>
#include <algorithm>

int TestD()
{
  deque<int> Tester, Tester2;


  for (int i = 0; i < 100; i++) {
    Tester.push_back(i*5);
    Tester2.push_front(i+2);
  }
  reverse(Tester.begin(), Tester.end());
  deque<int> Gf<Tester2>;		// This line is the reason.
  if (!(Gf == Tester2)) {		// Error occurs here.
    cout << "Error: copy isn't" << endl;
  }

  return 0;
}

int main() 
{
  for (int i = 0; i< 20; i++) {
    TestD();
    cout << "." << flush;
    sleep(2);
  }
  cout << endl;
  return 0;
}
=================================================================

If the "deque<int> Gf<Tester2>" is replaced with "deque<int> Gf(Tester2)",
the error disappears (note that the first form isn't valid code (at least
that I know)).

The compiler version is: egcs-1.0.2

g++ --version
egcs-2.90.27 980315 (egcs-1.0.2 release)

gcc-2.8.1 has the same problem.

================================ gcc-2.8.1 ==================================
 gcc -Wall -v -g -c Test.cpp
Reading specs from /home/thog/leven/gcc-2.8.1/i386/lib/gcc-lib/i686-pc-linux-gnu/2.8.1/specs
gcc version 2.8.1
 /home/thog/leven/gcc-2.8.1/i386/lib/gcc-lib/i686-pc-linux-gnu/2.8.1/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=8 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -g -Wall -Di386 -Di686 -Asystem(unix) -Acpu(i386) -Amachine(i386) -D__i386__ -D__i686__ -Asystem(unix) -Acpu(i386) -Amachine(i386) Test.cpp /var/tmp/cca02275.ii
GNU CPP version 2.8.1 (i386 GNU/Linux with ELF)
#include "..." search starts here:
#include <...> search starts here:
 /home/thog/leven/gcc-2.8.1/include/g++
 /usr/local/include
 /home/thog/leven/gcc-2.8.1/i386/i686-pc-linux-gnu/include
 /home/thog/leven/gcc-2.8.1/i386/lib/gcc-lib/i686-pc-linux-gnu/2.8.1/include
 /usr/include
End of search list.
 /home/thog/leven/gcc-2.8.1/i386/lib/gcc-lib/i686-pc-linux-gnu/2.8.1/cc1plus /var/tmp/cca02275.ii -quiet -dumpbase Test.cc -g -Wall -version -o /var/tmp/cca02275.s
GNU C++ version 2.8.1 (i686-pc-linux-gnu) compiled by GNU C version 2.8.1.
Test.cpp: In function `int TestD()':
Test.cpp:17: Internal compiler error 135.
Test.cpp:17: Please submit a full bug report to `bug-g++@prep.ai.mit.edu'.
=============================================================================

================================ egcs-1.0.2 =================================
g++ -Wall -v -g -c Test.cpp
Reading specs from /home/thog/leven/egcs-1.0.2/i386/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.90.27/specs
gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)
 /home/thog/leven/egcs-1.0.2/i386/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.90.27/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=90 -Di386 -D__ELF__ -Dunix -Dlinux -D__i386__ -D__ELF__ -D__unix__ -D__linux__ -D__i386 -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -g -Wall -Di386 -Di586 -Asystem(unix) -Acpu(i386) -Amachine(i386) -D__i386__ -D__i586__ -Asystem(unix) -Acpu(i386) -Amachine(i386) Test.cpp /var/tmp/cca24995.ii
GNU CPP version egcs-2.90.27 980315 (egcs-1.0.2 release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /home/thog/leven/egcs-1.0.2/include/g++
 /usr/local/include
 /home/thog/leven/egcs-1.0.2/i386/i586-pc-linux-gnu/include
 /home/thog/leven/egcs-1.0.2/i386/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.90.27/include
 /usr/include
End of search list.
 /home/thog/leven/egcs-1.0.2/i386/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.90.27/cc1plus /var/tmp/cca24995.ii -quiet -dumpbase Test.cc -g -Wall -version -o /var/tmp/cca24995.s
GNU C++ version egcs-2.90.27 980315 (egcs-1.0.2 release) (i586-pc-linux-gnu) compiled by GNU C version egcs-2.90.27 980315 (egcs-1.0.2 release).
Test.cpp: In function `int TestD()':
Test.cpp:17: Internal compiler error 135.
Test.cpp:17: Please submit a full bug report to `egcs-bugs@cygnus.com'.
=============================================================================





Bug report 2:
======================================================================
This bug is a problem in template expansion for the bit_vector class.
This problem does not occur for any of the other container classes 
(including the vector class).  The source code is the following:

============================== bvect.cc ============================== 
#include <iostream>
#include <vector>
#include <functional>


template <class C, class Position, class Iter>
void do_insert_range2( C& c, Position offset, 
                      Iter first, Iter last)
{
    typename C::iterator pos = c.begin();
    advance( pos, offset );
    c.insert( pos, first, last ); // Error occurs here.
}

int test_bv()
{
  static subtractive_rng rnd;
  bit_vector Foo1;

  Foo1.push_back( rnd(2) );
  Foo1.push_back( rnd(2) );

  size_t cnt = 1 + rnd(837);
  bool *list = new bit_vector::value_type[cnt];
  for (size_t n = 0; n < cnt; n++)
    list[n] = rnd(2);

  do_insert_range2(Foo1, rnd(Foo1.size()), list, list+cnt);
  
  return 0;
}

int main()
{
  for (int i = 0; i < 20; i++)
    test_bv();

  return 0;
}
======================================================================

What is interesting is that, for gcc-2.8.1 with -O1 turned on, the error
message moves to the header file for bit vector.  The compiler output
is below (same compiler as above, "-v" flag not used).

======================== egcs-1.0.2, -O0, -O1, -O2, -O3 ==================
g++ -c bvect.cc
bvect.cc: In function `void do_insert_range2<vector<bool,__default_alloc_template<true,0> >, unsigned int, bool *>(class vector<bool,__default_alloc_template<true,0> > &, unsigned int, bool *, bool *)':
bvect.cc:12: Internal compiler error.
bvect.cc:12: Please submit a full bug report to `egcs-bugs@cygnus.com'.

======================== gcc-2.8.1, -O0, -O2, -O3 ========================
g++ -O0 -c bvect.cc
bvect.cc: In function `void do_insert_range2<vector<bool,__default_alloc_template<true,0> >, unsigned int, bool *>(class vector<bool,__default_alloc_template<true,0> > &, unsigned int, bool *, bool *)':
bvect.cc:12: Internal compiler error.
bvect.cc:12: Please submit a full bug report to `bug-g++@prep.ai.mit.edu'.

======================== gcc-2.8.1, -O1 ========================
g++ -O1 -c bvect.cc
/home/thog/leven/gcc-2.8.1/include/g++/stl_bvector.h: In method `void vector<bool,__default_alloc_template<true,0> >::insert(struct __bit_iterator, bool *, bool *)':
/home/thog/leven/gcc-2.8.1/include/g++/stl_bvector.h:498: Internal compiler error.
/home/thog/leven/gcc-2.8.1/include/g++/stl_bvector.h:498: Please submit a full bug report to `bug-g++@prep.ai.mit.edu'.
=============================================================================





Warning message gripe 1:
======================================================================
Is there some way to get the following warning message turned off
(either by the compiler recognizing the type of the array and assuming
the numbers are of the same type), or by adding the "UL" extension to
the numbers?

/home/thog/leven/egcs-1.0.2/include/g++/stl_hashtable.h:150: warning: decimal integer constant is so large that it is unsigned
/home/thog/leven/egcs-1.0.2/include/g++/stl_hashtable.h:150: warning: decimal integer constant is so large that it is unsigned

A second gripe is the warning message about comparison between signed
and unsigned types in various places in the template library.  It is not
clear to me that there exists a solution for getting rid of these.


-- 
**********************************************************************
*   Peter Leven                          *  p-leven@uiuc.edu         * 
**  Lehrstuhl fuer Prozessrechner        *  Beckman Institute       **
**  Technische Universitaet Muenchen     *  Universitaet Illinois   **
*   http://www.uiuc.edu/ph/www/p-leven   *                           *
**********************************************************************


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