Re: plperl compiler warning

Lists: pgsql-hackers
From: Joe Conway <mail(at)joeconway(dot)com>
To: "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org>
Subject: plperl compiler warning
Date: 2010-01-28 14:31:19
Message-ID: 4B619FB7.6030001@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Last night I noted the following warning:

plperl.c: In function ‘plperl_create_sub’:

plperl.c:1117: warning: null argument where non-null required (argument 2)

I'm not familiar enough with this code to propose a fix...

Joe


From: Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: plperl compiler warning
Date: 2010-01-28 15:30:27
Message-ID: 20100128153027.GB38673@timac.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Jan 28, 2010 at 06:31:19AM -0800, Joe Conway wrote:
> Last night I noted the following warning:
>
> plperl.c: In function ‘plperl_create_sub’:
>
> plperl.c:1117: warning: null argument where non-null required (argument 2)

The master branch of my git clone says line 1117 is:

subref = newRV_inc((SV*)GvCVu((GV*)sub_glob));

Does that match yours? (If not, what is the text on the line?)

What perl version are you using?
What compiler version are you using?

Tim.


From: Joe Conway <mail(at)joeconway(dot)com>
To: Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>
Cc: "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: plperl compiler warning
Date: 2010-01-28 16:27:04
Message-ID: 4B61BAD8.7000903@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 01/28/2010 07:30 AM, Tim Bunce wrote:
> On Thu, Jan 28, 2010 at 06:31:19AM -0800, Joe Conway wrote:
>> Last night I noted the following warning:
>>
>> plperl.c: In function ‘plperl_create_sub’:
>>
>> plperl.c:1117: warning: null argument where non-null required (argument 2)
>
> The master branch of my git clone says line 1117 is:
>
> subref = newRV_inc((SV*)GvCVu((GV*)sub_glob));
>
> Does that match yours? (If not, what is the text on the line?)

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:

perl.x86_64 4:5.10.0-87.fc12
gcc.x86_64 4.4.2-20.fc12

HTH,

Joe


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: 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 17:49:20
Message-ID: 17950.1264700960@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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.

regards, tom lane


From: Andrew Dunstan <andrew(at)dunslane(dot)net>
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:47:35
Message-ID: 4B61E9D7.2040400@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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.
>
>
>

It's on my F11 box too ... I guess it's time to upgrade my work machine,
doesn't get reported by my usual setup.

Tim, any suggestions?

cheers

andrew


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
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

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Joe Conway <mail(at)joeconway(dot)com>, "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: plperl compiler warning
Date: 2010-01-28 23:07:47
Message-ID: 4B6218C3.1010004@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tim Bunce wrote:
>>
>> 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.
>
>

Thanks. Applied.

cheers

andrew


From: Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>
To: "Hackers (PostgreSQL)" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: plperl compiler warning
Date: 2010-01-29 11:56:50
Message-ID: 20100129115650.GT38673@timac.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Jan 28, 2010 at 07:49:37PM +0000, Tim Bunce wrote:
>
> I think I missed this because the Xcode compiler on Snow Leopard is
> fairly old (gcc 4.2.1).

For the record, gcc 4.2.1 does report the error. I'd missed it because
I'd done most of my builds with perl 5.8.x and the notnull attributes was
added later, in 5.10.0.

Tim.