public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18037] New: g++ segfaults on templated code (simple test file included)
@ 2004-10-17  1:40 mfowles at bluefinrobotics dot com
  2004-10-17  1:41 ` [Bug c++/18037] " mfowles at bluefinrobotics dot com
  2004-10-17  2:24 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: mfowles at bluefinrobotics dot com @ 2004-10-17  1:40 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/18037] g++ segfaults on templated code (simple test file included)
  2004-10-17  1:40 [Bug c++/18037] New: g++ segfaults on templated code (simple test file included) mfowles at bluefinrobotics dot com
@ 2004-10-17  1:41 ` mfowles at bluefinrobotics dot com
  2004-10-17  2:24 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: mfowles at bluefinrobotics dot com @ 2004-10-17  1:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mfowles at bluefinrobotics dot com  2004-10-17 01:41 -------
Created an attachment (id=7365)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=7365&action=view)
the file that makes it segfault


-- 


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/18037] g++ segfaults on templated code (simple test file included)
  2004-10-17  1:40 [Bug c++/18037] New: g++ segfaults on templated code (simple test file included) mfowles at bluefinrobotics dot com
  2004-10-17  1:41 ` [Bug c++/18037] " mfowles at bluefinrobotics dot com
@ 2004-10-17  2:24 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-17  2:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-17 02:24 -------
Fixed in 3.4.0 and above, the code is invalid:
template<class T> PatternMap<T>::iterator& 
      PatternMap<T>::iterator::iterator& operator++(

"iterator& operator" should be "iterator::operator" and there needs to be a typename infront
of the first "PatternMap<T>::iterator&".

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
           Keywords|                            |ice-on-invalid-code
         Resolution|                            |FIXED
   Target Milestone|---                         |3.4.0


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-10-17  2:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-17  1:40 [Bug c++/18037] New: g++ segfaults on templated code (simple test file included) mfowles at bluefinrobotics dot com
2004-10-17  1:41 ` [Bug c++/18037] " mfowles at bluefinrobotics dot com
2004-10-17  2:24 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).