develooper Front page | perl.perl5.porters | Postings from October 2013

broken clang warning (was Re: Smoke [blead] v5.19.4-134-ga9c9e37PASS linux 3.8.0-30-generic [debian] (x86_64/8 cpu) {blead_clang_quick})

Thread Next
From:
Nicholas Clark
Date:
October 4, 2013 14:14
Subject:
broken clang warning (was Re: Smoke [blead] v5.19.4-134-ga9c9e37PASS linux 3.8.0-30-generic [debian] (x86_64/8 cpu) {blead_clang_quick})
Message ID:
20131004141420.GC1584@plum.flirble.org
On Fri, Oct 04, 2013 at 02:21:00AM -0400, George Greer wrote:
> Smoke logs available at http://m-l.org/~perl/smoke/perl/linux/blead_clang_quick/loga9c9e371c40cf388593577cf577494e91793f62a.log.gz

>     using     clang version 4.2.1 Compatible Clang 3.4 (trunk 189633)

> Storable.xs:4144:2: warning: null passed to a callee which requires a non-null argument [-Wnonnull]
> Storable.xs:4341:3: warning: null passed to a callee which requires a non-null argument [-Wnonnull]
> Storable.xs:5716:2: warning: null passed to a callee which requires a non-null argument [-Wnonnull]
> Storable.xs:5779:2: warning: null passed to a callee which requires a non-null argument [-Wnonnull]

I think that clang is getting upset by the call to sv_bless in this macro:

#define SEEN(y,stash,i)						\
  STMT_START {								\
	if (!y)									\
		return (SV *) 0;					\
	if (av_store(cxt->aseen, cxt->tagnum++, i ? (SV*)(y) : SvREFCNT_inc(y)) == 0) \
		return (SV *) 0;					\
	TRACEME(("aseen(#%d) = 0x%"UVxf" (refcnt=%d)", cxt->tagnum-1, \
		 PTR2UV(y), SvREFCNT(y)-1));		\
	if (stash)								\
		BLESS((SV *) (y), (HV *)(stash));			\
  } STMT_END

when the macro is used with stash of NULL.

This looks to me like a bug in clang, as it's warning on unreachable code -
if it knows that stash is 0, then it also knows that if (stash) is if (0).

I can't spot an easy way to work round this.

Nicholas Clark

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