Re: plperl compiler warning

From: Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Joe Conway <mail(at)joeconway(dot)com>, Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>, "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: plperl compiler warning
Date: 2010-01-28 19:49:37
Message-ID: 20100128194936.GH38673@timac.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 28, 2010 at 12:49:20PM -0500, Tom Lane wrote:
> Joe Conway <mail(at)joeconway(dot)com> writes:
> > I pull directly from CVS, not git, but in any case my line 1117 is
> > subref = newRV_inc((SV*)GvCVu((GV*)sub_glob));
> > so it appears to be the same
>
> >> What perl version are you using?
> >> What compiler version are you using?
> > I'm on stock Fedora 12:
>
> I see the same on Fedora 11. The -E expansion of the line in question is
>
> subref = Perl_newRV(((PerlInterpreter *)pthread_getspecific((*Perl_Gthr_key_ptr(((void *)0))))), (SV*)((((GV*)sub_glob)->sv_u.svu_gp)->gp_cvgen ? ((void *)0) : (((GV*)sub_glob)->sv_u.svu_gp)->gp_cv));
>
> so it's evidently unhappy about the fact that GvCVu can return null,
> while Perl_newRV is declared __attribute__((nonnull(2))).
>
> It looks to me like this is probably a live bug not just compiler
> hypersensitivity.

Yes. (ISTR there have been cases where the notnull attribute was
misapplied to some perl functions, but that's not the case here.)

I think I missed this because the Xcode compiler on Snow Leopard is
fairly old (gcc 4.2.1).

Patch attached.

Tim.

Attachment Content-Type Size
plperl-fix-GvCVu-warn.patch text/x-patch 636 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2010-01-28 19:50:57 Re: Review: Typed Table
Previous Message Andrew Dunstan 2010-01-28 19:47:35 Re: plperl compiler warning