Internal compiler error: Error reporting routines re-entered

Bug #1177790 reported by bluehood
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
gcc-4.7 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

I tried to compile the following code on Ubuntu 12.04, 64-bit version with command line "g++ -std=c++11 shared.cpp"

COMPILER OUTPUT:
Internal compiler error: Error reporting routines re-entered.
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.
Preprocessed source stored into /tmp/cclhuYkr.out file, please attach this to your bugreport.

**************************************************
shared.cpp

#include <memory>
#include <vector>

class myclass
{
 public:
 void add(std::shared_ptr<myclass> sp) { vec.push_back(sp); if(! sp->has(this) ) sp->add(this); }
 void add(myclass* p) { vec.push_back(std::make_shared<myclass>(p)); }

 bool has(std::shared_ptr<myclass> sp) { for(auto& x : vec) { if(x.lock()==sp) return true; } return false; }
 bool has(myclass* p ) { for(auto& x : vec) { if(x.lock().get() == p) return true; } return false; }

 std::vector<std::weak_ptr<myclass>> vec;
};

int main()
{
    return 0;
}

Revision history for this message
Berthold Stoeger (bstoeger-a) wrote :

I get the same error message with std::unique_ptr:

#include <vector>

class A {};

class B {
public:
        std::unique_ptr<A> e;
        B &operator=(const B &d2);
};

void fun(std::unique_ptr<B> &arg)
{
        std::vector<B> v;
        v.push_back(std::move(*arg));
}

Compiled with "g++-4.7 -c -O3 -g -std=c++0x -Wall -o crash.o crash.C" results in:

Internal compiler error: Error reporting routines re-entered.
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.
Preprocessed source stored into /tmp/cclP69wn.out file, please attach this to your bugreport.

(Note the ‘ sign in the first line)

Revision history for this message
Berthold Stoeger (bstoeger-a) wrote :

NB: The file compiles correctly if the necessary copy constructor is added:

#include <memory>
#include <vector>

class A {};

class B {
public:
        std::unique_ptr<A> e;
        B &operator=(const B &d2);
        B(const B&);
};

void fun(B &arg)
{
        std::vector<B> v;
        v.push_back(arg);
}

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gcc-4.7 (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.