develooper Front page | perl.perl5.porters | Postings from May 2010

Re: 5.12: inplace sort <*> segfault (gcc 4.5.0 bug?)

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
May 11, 2010 02:41
Subject:
Re: 5.12: inplace sort <*> segfault (gcc 4.5.0 bug?)
Message ID:
20100511094051.GF2576@plum.flirble.org
On Mon, May 10, 2010 at 05:21:52PM -0600, Alex Hunsaker wrote:
> (Find at the bottom gcc, perl -V and uname output)

> backtrace:
> Program received signal SIGSEGV, Segmentation fault.
> S_is_inplace_av (o=<value optimized out>, oright=<value optimized
> out>, my_perl=<value optimized out>, o=<value optimized out>,
> oright=<value optimized out>)
>     at op.c:8418
> 8418		(oright->op_type != OP_RV2AV && oright->op_type != OP_PADAV)
> (gdb) bt
> #0  S_is_inplace_av (o=<value optimized out>, oright=<value optimized
> out>, my_perl=<value optimized out>, o=<value optimized out>,
>     oright=<value optimized out>) at op.c:8418
> #1  0x000000000042510d in Perl_peep (my_perl=0x8a3f90, o=0x8ccc50) at op.c:8923

> I get:
> oright: (nil)
> inplace_av: oright: (nil)
> Segmentation fault
> 
> Hrm Ok seems like gcc decided oright can never be NULL and so took out
> those checks.  If I do an optimize='-g' no -O2 it seems to work.  Any
> ideas?

I am confident that it's not a misplaced __attribute__nonnull__ on oright.
(These have been a problem before). It's gcc that has decided that oright
can't be NULL, rather than us telling it.

Your analysis looks sound to me. I can reproduce it on blead with gcc 4.5.0,
with -Dusemultiplicity (but not with other related Configure options).

I can't stop gcc doing it by adding -fno-inline to the compiler flags - its
optimiser seems adamant that oright can never be NULL.

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About