Re: [gdb-7.0 release] 2009-09-02 status and proposed plan

Paul Pluzhnikov
2009-09-04T17:59:15Z

On Fri, Sep 4, 2009 at 8:25 AM, Paul Pluzhnikov<ppluzhnikov@google.com> wrote:

> I am still working on a stand-alone repro case.

Here it is:

--- cut --- foo.cc ---
#include <stdio.h>

#define X6(a) a,a,a,a,a,a
#define R8(a) a##a##a##a##a##a##a##a##a

#define Foo R8(Fee_Fi_Fo_Fum_I_smell_the_blood_of_an_Englishman)
#define Bar R8(Bar)

template <class P, class Q, class R, class S, class T, class U>
struct Foo { Foo(); };

template <class P, class Q, class R, class S, class T, class U>
Foo<P, Q, R, S, T, U>::Foo()
{
printf ("In %s\n", __func__);
}

struct Bar { };

typedef Foo<X6(Bar)> FooBar1;
typedef Foo<X6(FooBar1)> FooBar2;
typedef Foo<X6(FooBar2)> FooBar3;
typedef Foo<X6(FooBar3)> FooBar4;
typedef Foo<X6(FooBar4)> FooBar5;

struct Zork { int x; };

int fn(int *ip)
{
FooBar1 f1;
FooBar2 f2;
FooBar3 f3;
FooBar4 f4;
FooBar5 f5;

Zork z;
z.x = ip[0]; // crash
return z.x;
}
--- cut --- foo.cc ---

--- cut --- main.cc ---
int fn(int *);
int main() { return fn(0); }
--- cut --- main.cc ---

g++ -g -fPIC -shared foo.cc -o foo.so && g++ -g main.cc ./foo.so

gdb64-cvs ./a.out
GNU gdb (GDB) 6.8.50.20090904-cvs
...
Reading symbols from /usr/local/google/tmp/gdb-crash/a.out...done.
(gdb) run
In Fee_Fi_Fo_Fum_I_smell...

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7bdf1d9 in fn (ip=0x0) at foo.cc:37
37 z.x = ip[0]; // crash

(gdb) py x = gdb.lookup_type('Zork')
(gdb) run
Segmentation fault (core dumped)

I will not be able to work on a fix before next Tuesday, so if anybody
fixes this before then, please let me know.

Thanks,
--
Paul Pluzhnikov