Re: strange path through code (initdb problem) - Mailing list pgsql-hackers

From Keith Parks
Subject Re: strange path through code (initdb problem)
Date
Msg-id 199808282111.WAA09884@mtcc.demon.co.uk
Whole thread Raw
Responses Re: strange path through code (initdb problem)  (Bruce Momjian <maillist@candle.pha.pa.us>)
List pgsql-hackers
Bruce Momjian <maillist@candle.pha.pa.us>

> Are you compiling with optimization. Thay may do it.

Yes, and it does :-(

Compiled with -O0 everything works fine (well almost).
With -O2, the default, I get the SIGSEGV as before.

I seem to remember I had this optimisation problem some while
ago and someone, Thomas?, fixed it by rewriting some code.

So, for now I'm reasonably happy and can get on with some
testing.

Thanks,
Keith.

BTW: this is tested after Jan's fix for indexes. (Thanks Jan)

> > Keith Parks
> >
> > The latest changes do not seem to have fixed my problems
> > (assumed to be alignment)
> >
> > What I find really strange is the path taken through the
> > code when stepping upto the SIGSEGV.
> >
> > ie. how do we get to line 208 in heaptuple.c (the other half of
> >     the if/else statement) without passing through line 203??
> >
> >     Remembering that we should never touch line 208 if the
> >     attalign is 'd'
> >
> > Puzzled,
> > Keith.
> >
> > 163                     switch (att[i]->attlen)
> > (gdb)
> > 195                                     if (att[i]->attlen < sizeof(int32))
> > (gdb)
> > 198                                     if (att[i]->attalign == 'd')
> > (gdb)
> > 200                                             data = (char *)
> > DOUBLEALIGN(data);
> > (gdb)
> > 201                                             memmove(data,
> > DatumGetPointer(value[i]),
> > (gdb)
> > 204                                     }
> > (gdb)
> > 208                                             memmove(data,
> > DatumGetPointer(value[i]),
> > (gdb)
> >
> > Program received signal SIGSEGV, Segmentation fault.
> >
> >
>
>
> --
> Bruce Momjian                          |  830 Blythe Avenue
> maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
>   +  If your life is a hard drive,     |  (610) 353-9879(w)
>   +  Christ can be your backup.        |  (610) 853-3000(h)


pgsql-hackers by date:

Previous
From: The Hermit Hacker
Date:
Subject: Re: [HACKERS] ecpg patches
Next
From: Bruce Momjian
Date:
Subject: Re: strange path through code (initdb problem)