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]
Other format: [Raw text]

[Bug c++/18037] New: g++ segfaults on templated code (simple test file included)


mfowles@fowles:~/random/gcc$ g++ -v -save-temps foo.cpp 
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.4/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib
--enable-nls --without-included-gettext --enable-__cxa_atexit
--enable-clocale=gnu --enable-debug --enable-java-gc=boehm
--enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.4 (Debian 1:3.3.4-13)
 /usr/lib/gcc-lib/i486-linux/3.3.4/cc1plus -E -D__GNUG__=3 -quiet -v
-D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=4 -D_GNU_SOURCE foo.cpp foo.ii
ignoring nonexistent directory "/usr/i486-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/3.3
 /usr/include/c++/3.3/i486-linux
 /usr/include/c++/3.3/backward
 /usr/local/include
 /usr/lib/gcc-lib/i486-linux/3.3.4/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i486-linux/3.3.4/cc1plus -fpreprocessed foo.ii -quiet
-dumpbase foo.cpp -auxbase foo -version -o foo.s
GNU C++ version 3.3.4 (Debian 1:3.3.4-13) (i486-linux)
        compiled by GNU C version 3.3.4 (Debian 1:3.3.4-13).
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64537
foo.cpp:50: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions, see
<URL:file:///usr/share/doc/gcc-3.3/README.Bugs>.
mfowles@fowles:~/random/gcc$ cat foo.cpp
#include <vector>
#include <map>

template<class T>
class PatternMap {
    typedef std::vector<T> vecT;
    typedef std::pair<int, vecT> pairT;
    typedef std::vector<pairT> vecP;
    typedef std::map<int, vecT> mapT;

    public:

    class iterator {
        public:
            iterator(const iterator& i);
            ~iterator();

            T& operator*();
            T* operator->();

            iterator& operator++();
            iterator operator++(int);

            bool atEnd() const;
        private:
            iterator();
            void updateMixed();

            int n;
            vecT* allParent;
            typename vecT::iterator all;
            vecP* mixedParent;
            typename vecP::iterator mixed;
            vecT* literalParent;
            typename vecT::iterator literal;
    };

    PatternMap();
    virtual ~PatternMap();

    iterator find(const int &n);

    private:
    vecT all;
    mapT mixed;
    mapT literal;
};

  template<class T> PatternMap<T>::iterator& 
      PatternMap<T>::iterator::iterator& operator++() {
          if(allParent && all != allParent->end()) {
              ++all;
              if(all == allParent->end()) {
                  updateMixed();
              }
              return *this;
          }
          if(mixedParent && mixed != mixedParent->end()) {
              ++mixed;
              updateMixed();
              return *this;
          }
          if(literalParent && literal != literalParent->end()) {
              ++litIt;
          }
          return *this;
      }

int main(int argc, char** argv) {

}
mfowles@fowles:~/random/gcc$

-- 
           Summary: g++ segfaults on templated code (simple test file
                    included)
           Product: gcc
           Version: 3.3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mfowles at bluefinrobotics dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18037


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