[Bug ld/12730] [regression] crash when allocating in a static constructor

2011-05-13 Thread eugen.d...@pu-pm.univ-fcomte.fr
http://sourceware.org/bugzilla/show_bug.cgi?id=12730

Eugen Dedu  changed:

   What|Removed |Added

 CC||eugen.d...@pu-pm.univ-fcomt
   ||e.fr

--- Comment #5 from Eugen Dedu  2011-05-13 
21:21:38 UTC ---
It turns out that the fix was only partial.  With the fix, I have finally been
able to reproduce the crash with two files.

$ cat >a.cxx
#include 

class Hello
{
public:
   Hello () {}
  ~Hello () {}
  void act (void);
};

void Hello::act (void)
{
  std::cout << "Hello, world!" << std::endl;
}

$ cat >aa.cxx
#include 
class Hello
{
public:
  Hello ();
  ~Hello ();
  void act (void);
};

static void __attribute__ (( constructor )) PWLIB_StaticLoader() {
  __gnu_cxx::bitmap_allocator allocator;
  Hello* salut = allocator._M_allocate_single_object ();
  salut->act ();
}

int main (void)
{
  return 0;
}

$ g++ aa.cxx a.cxx
$ ./a.out
Segmentation fault

By chance, I discovered that the order of compilation is important:
$ g++ a.cxx aa.cxx
$ ./a.out
Hello, world!

Cheers,
Eugen

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug ld/12730] [regression] crash when allocating in a static constructor

2011-05-19 Thread eugen.d...@pu-pm.univ-fcomte.fr
http://sourceware.org/bugzilla/show_bug.cgi?id=12730

--- Comment #10 from Eugen Dedu  2011-05-19 
14:51:25 UTC ---
(In reply to comment #9)
> (In reply to comment #7)
> > Created attachment 5728 [details]
> > Test program to demonstrate allocate crash
> 
> I don't think it is a linker problem.  Please report it to GCC.

For info, the new bug report is found at
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49037.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils