[PD-dev] libpd iOS 64 bit crash with variadic function pointers

Dan Wilcox danomatika at gmail.com
Fri Mar 7 16:42:10 CET 2014


Good news Miller. The report so far is that your latest fix is working for arm64 iOS:

https://github.com/libpd/libpd/issues/56#issuecomment-37010342

On Feb 23, 2014, at 2:48 PM, Dan Wilcox <danomatika at gmail.com> wrote:

> Could we just make that t_gotfn1 update to chaos? I could provide a patch etc if required. If that's the only conflict, why not just zap it now?
> 
> On Feb 23, 2014, at 1:58 PM, Miller Puckette <msp at ucsd.edu> wrote:
> 
>> That checks with what I found... looks like the only major change will be
>> that chaos will need to quite relying on t_gotfn and either use t_gotfn1
>> or (better) define it sown type for the way it's getting used.  Anyhow, the
>> code won't work in arm64 without changes in any way I can see.
>> 
>> cheers
>> Miller
>> 
>> On Sun, Feb 23, 2014 at 11:13:59AM -0500, Dan Wilcox wrote:
>>> Howdy again Miller,
>>> 
>>> I manually applied your last 2 commits to the libpd pd_0.45-4 branch. Hopefully people with the actual hardware will give it a test and chime in.
>>> 
>>> I also put together a little script to check for string patterns in source files and ran it on the externals in the sourceforge svn for the mess* functions and t_got_fn. It doesn't look that bad overall.
>>> 
>>> Here's the output:
>>> 
>>> --------------------------------------------------------------------------------
>>> Checking for " mess1(" ...
>>> 
>>> ./algocomp/m_pd.h:
>>> 231:#define mess1(x, s, a) ((*getfn((x), (s)))((x), (a)))
>>> 
>>> ./grill/dynext/src/main.cpp:
>>> 952:    mess1((t_pd *)canvas,const_cast<t_symbol *>(sym_dsp),NULL);
>>> 
>>> --------------------------------------------------------------------------------
>>> Checking for " mess2(" ...
>>> 
>>> ./algocomp/m_pd.h:
>>> 232:#define mess2(x, s, a,b) ((*getfn((x), (s)))((x), (a),(b)))
>>> 
>>> --------------------------------------------------------------------------------
>>> Checking for " mess3(" ...
>>> 
>>> ./algocomp/m_pd.h:
>>> 233:#define mess3(x, s, a,b,c) ((*getfn((x), (s)))((x), (a),(b),(c)))
>>> 
>>> --------------------------------------------------------------------------------
>>> Checking for " mess4(" ...
>>> 
>>> ./algocomp/m_pd.h:
>>> 234:#define mess4(x, s, a,b,c,d) ((*getfn((x), (s)))((x), (a),(b),(c),(d)))
>>> 
>>> --------------------------------------------------------------------------------
>>> Checking for " mess5(" ...
>>> 
>>> ./algocomp/m_pd.h:
>>> 235:#define mess5(x, s, a,b,c,d,e) ((*getfn((x), (s)))((x), (a),(b),(c),(d),(e)))
>>> 
>>> --------------------------------------------------------------------------------
>>> Checking for "t_gotfn" ...
>>> 
>>> ./algocomp/m_pd.h:
>>> 204:typedef void (*t_gotfn)(void *x, ...); 226:EXTERN t_gotfn getfn(t_pd *x, t_symbol *s); 227:EXTERN t_gotfn zgetfn(t_pd *x, t_symbol *s);
>>> 
>>> ./chaos/attract1.c:
>>> 168:	if (lyapunov_full((void *) attract1, (t_gotfn) calc, M_var_count, attract1 -> vars, results) != NULL) { 297:		attract1 -> lyap_exp = lyapunov((void *) attract1, (t_gotfn) calc, M_var_count, (double *) attract1 -> vars);
>>> 
>>> ./chaos/base.c:
>>> 135:	if (lyapunov_full((void *) base, (t_gotfn) calc, M_var_count, base -> vars, results) != NULL) { 212:		base -> lyap_exp = lyapunov((void *) base, (t_gotfn) calc, M_var_count, (double *) base -> vars);
>>> 
>>> ./chaos/base3.c:
>>> 135:	if (lyapunov_full((void *) base3, (t_gotfn) calc, M_var_count, base3 -> vars, results) != NULL) { 212:		base3 -> lyap_exp = lyapunov((void *) base3, (t_gotfn) calc, M_var_count, (double *) base3 -> vars);
>>> 
>>> ./chaos/chaos.h:
>>> 17:double lyapunov(void *fractal, t_gotfn calc, int var_count, double *vars); 25:double *lyapunov_full(void *fractal, t_gotfn calc, int var_count, double *vars, double *results);
>>> 
>>> ./chaos/dejong.c:
>>> 156:	if (lyapunov_full((void *) dejong, (t_gotfn) calc, M_var_count, dejong -> vars, results) != NULL) { 259:		dejong -> lyap_exp = lyapunov((void *) dejong, (t_gotfn) calc, M_var_count, (double *) dejong -> vars);
>>> 
>>> ./chaos/henon.c:
>>> 144:	if (lyapunov_full((void *) henon, (t_gotfn) calc, M_var_count, henon -> vars, results) != NULL) { 221:		henon -> lyap_exp = lyapunov((void *) henon, (t_gotfn) calc, M_var_count, (double *) henon -> vars);
>>> 
>>> ./chaos/hopalong.c:
>>> 150:	if (lyapunov_full((void *) hopalong, (t_gotfn) calc, M_var_count, hopalong -> vars, results) != NULL) { 240:		hopalong -> lyap_exp = lyapunov((void *) hopalong, (t_gotfn) calc, M_var_count, (double *) hopalong -> vars);
>>> 
>>> ./chaos/ikeda.c:
>>> 159:	if (lyapunov_full((void *) ikeda, (t_gotfn) calc, M_var_count, ikeda -> vars, results) != NULL) { 262:		ikeda -> lyap_exp = lyapunov((void *) ikeda, (t_gotfn) calc, M_var_count, (double *) ikeda -> vars);
>>> 
>>> ./chaos/latoocarfian.c:
>>> 156:	if (lyapunov_full((void *) latoocarfian, (t_gotfn) calc, M_var_count, latoocarfian -> vars, results) != NULL) { 259:		latoocarfian -> lyap_exp = lyapunov((void *) latoocarfian, (t_gotfn) calc, M_var_count, (double *) latoocarfian -> vars);
>>> 
>>> ./chaos/latoomutalpha.c:
>>> 156:	if (lyapunov_full((void *) latoomutalpha, (t_gotfn) calc, M_var_count, latoomutalpha -> vars, results) != NULL) { 259:		latoomutalpha -> lyap_exp = lyapunov((void *) latoomutalpha, (t_gotfn) calc, M_var_count, (double *) latoomutalpha -> vars);
>>> 
>>> ./chaos/latoomutbeta.c:
>>> 156:	if (lyapunov_full((void *) latoomutbeta, (t_gotfn) calc, M_var_count, latoomutbeta -> vars, results) != NULL) { 259:		latoomutbeta -> lyap_exp = lyapunov((void *) latoomutbeta, (t_gotfn) calc, M_var_count, (double *) latoomutbeta -> vars);
>>> 
>>> ./chaos/latoomutgamma.c:
>>> 156:	if (lyapunov_full((void *) latoomutgamma, (t_gotfn) calc, M_var_count, latoomutgamma -> vars, results) != NULL) { 259:		latoomutgamma -> lyap_exp = lyapunov((void *) latoomutgamma, (t_gotfn) calc, M_var_count, (double *) latoomutgamma -> vars);
>>> 
>>> ./chaos/libchaos.c:
>>> 22:double lyapunov_eval(void *fractal, t_gotfn calc, int var_count, double *vars, double *test) { 53:double lyapunov(void *fractal, t_gotfn calc, int var_count, double *vars) { 65:double *lyapunov_full(void *fractal, t_gotfn calc, int var_count, double *vars, double *results) {
>>> 
>>> ./chaos/logistic.c:
>>> 129:	if (lyapunov_full((void *) logistic, (t_gotfn) calc, M_var_count, logistic -> vars, results) != NULL) { 193:		logistic -> lyap_exp = lyapunov((void *) logistic, (t_gotfn) calc, M_var_count, (double *) logistic -> vars);
>>> 
>>> ./chaos/lorenz.c:
>>> 163:	if (lyapunov_full((void *) lorenz, (t_gotfn) calc, M_var_count, lorenz -> vars, results) != NULL) { 266:		lorenz -> lyap_exp = lyapunov((void *) lorenz, (t_gotfn) calc, M_var_count, (double *) lorenz -> vars);
>>> 
>>> ./chaos/lotkavolterra.c:
>>> 156:	if (lyapunov_full((void *) lotkavolterra, (t_gotfn) calc, M_var_count, lotkavolterra -> vars, results) != NULL) { 259:		lotkavolterra -> lyap_exp = lyapunov((void *) lotkavolterra, (t_gotfn) calc, M_var_count, (double *) lotkavolterra -> vars);
>>> 
>>> ./chaos/martin.c:
>>> 138:	if (lyapunov_full((void *) martin, (t_gotfn) calc, M_var_count, martin -> vars, results) != NULL) { 202:		martin -> lyap_exp = lyapunov((void *) martin, (t_gotfn) calc, M_var_count, (double *) martin -> vars);
>>> 
>>> ./chaos/mlogistic.c:
>>> 129:	if (lyapunov_full((void *) mlogistic, (t_gotfn) calc, M_var_count, mlogistic -> vars, results) != NULL) { 193:		mlogistic -> lyap_exp = lyapunov((void *) mlogistic, (t_gotfn) calc, M_var_count, (double *) mlogistic -> vars);
>>> 
>>> ./chaos/pickover.c:
>>> 163:	if (lyapunov_full((void *) pickover, (t_gotfn) calc, M_var_count, pickover -> vars, results) != NULL) { 266:		pickover -> lyap_exp = lyapunov((void *) pickover, (t_gotfn) calc, M_var_count, (double *) pickover -> vars);
>>> 
>>> ./chaos/popcorn.c:
>>> 138:	if (lyapunov_full((void *) popcorn, (t_gotfn) calc, M_var_count, popcorn -> vars, results) != NULL) { 202:		popcorn -> lyap_exp = lyapunov((void *) popcorn, (t_gotfn) calc, M_var_count, (double *) popcorn -> vars);
>>> 
>>> ./chaos/quadruptwo.c:
>>> 150:	if (lyapunov_full((void *) quadruptwo, (t_gotfn) calc, M_var_count, quadruptwo -> vars, results) != NULL) { 240:		quadruptwo -> lyap_exp = lyapunov((void *) quadruptwo, (t_gotfn) calc, M_var_count, (double *) quadruptwo -> vars);
>>> 
>>> ./chaos/rossler.c:
>>> 163:	if (lyapunov_full((void *) rossler, (t_gotfn) calc, M_var_count, rossler -> vars, results) != NULL) { 266:		rossler -> lyap_exp = lyapunov((void *) rossler, (t_gotfn) calc, M_var_count, (double *) rossler -> vars);
>>> 
>>> ./chaos/standardmap.c:
>>> 138:	if (lyapunov_full((void *) standardmap, (t_gotfn) calc, M_var_count, standardmap -> vars, results) != NULL) { 202:		standardmap -> lyap_exp = lyapunov((void *) standardmap, (t_gotfn) calc, M_var_count, (double *) standardmap -> vars);
>>> 
>>> ./chaos/strange1.c:
>>> 204:	if (lyapunov_full((void *) strange1, (t_gotfn) calc, M_var_count, strange1 -> vars, results) != NULL) { 411:		strange1 -> lyap_exp = lyapunov((void *) strange1, (t_gotfn) calc, M_var_count, (double *) strange1 -> vars);
>>> 
>>> ./chaos/tent.c:
>>> 129:	if (lyapunov_full((void *) tent, (t_gotfn) calc, M_var_count, tent -> vars, results) != NULL) { 193:		tent -> lyap_exp = lyapunov((void *) tent, (t_gotfn) calc, M_var_count, (double *) tent -> vars);
>>> 
>>> ./chaos/three_d.c:
>>> 169:	if (lyapunov_full((void *) three_d, (t_gotfn) calc, M_var_count, three_d -> vars, results) != NULL) { 285:		three_d -> lyap_exp = lyapunov((void *) three_d, (t_gotfn) calc, M_var_count, (double *) three_d -> vars);
>>> 
>>> ./chaos/threeply.c:
>>> 150:	if (lyapunov_full((void *) threeply, (t_gotfn) calc, M_var_count, threeply -> vars, results) != NULL) { 240:		threeply -> lyap_exp = lyapunov((void *) threeply, (t_gotfn) calc, M_var_count, (double *) threeply -> vars);
>>> 
>>> ./chaos/tinkerbell.c:
>>> 156:	if (lyapunov_full((void *) tinkerbell, (t_gotfn) calc, M_var_count, tinkerbell -> vars, results) != NULL) { 259:		tinkerbell -> lyap_exp = lyapunov((void *) tinkerbell, (t_gotfn) calc, M_var_count, (double *) tinkerbell -> vars);
>>> 
>>> ./miXed/riddle/riddle.c:
>>> 873:    t_gotfn freefn = zgetfn((t_pd *)rd, gensym("_free"));
>>> 
>>> ./miXed/shared/unstable/fragile.c:
>>> 54:	    if (mp->me_fun == (t_gotfn)thiscall) 102:	if (mp->me_name == cname && mp->me_fun != (t_gotfn)thiscall)
>>> 
>>> ./miXed/shared/unstable/pd_imp.h:
>>> 17:    t_gotfn me_fun;
>>> 
>>> --------------------------------------------------------------------------------
>>> 
>>> On Feb 22, 2014, at 6:00 AM, pd-dev-request at iem.at wrote:
>>> 
>>>> From: Dan Wilcox <danomatika at gmail.com>
>>>> Subject: Re: [PD-dev] libpd iOS 64 bit crash with variadic function pointers
>>>> Date: February 21, 2014 at 8:58:25 AM EST
>>>> To: Miller Puckette <msp at ucsd.edu>
>>>> Cc: pd-dev at iem.at
>>>> 
>>>> 
>>>> Thanks Miller. Is that to the Sourceforge git or some other place? I'll pull it down into libpd and get people to test it.
>>>> 
>>>> On Feb 21, 2014, at 6:00 AM, pd-dev-request at iem.at wrote:
>>>> 
>>>>> It looks like the whole mess1() (etc) macro system is going to fail on
>>>>> 64-bit ARM - I can't see how to patch that.  I can fix the local problems in
>>>>> the Pd vanilla source but I don't know whether it's better to take out the
>>>>> "mess()" macros altogether, or to take them out only for ARM64.  (The
>>>>> former would be source incompatible but object compatible, but I'm thinking
>>>>> source compatibilty with a non-working feature is maybe actually worse than
>>>>> simply being source incompatible.)
>>>>> 
>>>>> I've gone ahead and git-pushed an attempted fix (changing mess1() etc, 
>>>>> potentially source-incompatibly) but am open to other ideas how to fix this.
>>>> 
>>>> --------
>>>> Dan Wilcox
>>>> @danomatika
>>>> danomatika.com
>>>> robotcowboy.com
>>> 
>>> --------
>>> Dan Wilcox
>>> @danomatika
>>> danomatika.com
>>> robotcowboy.com
>>> 
>>> 
>>> 
>>> 
>>> 
> 
> --------
> Dan Wilcox
> @danomatika
> danomatika.com
> robotcowboy.com
> 
> 
> 
> 
> 

--------
Dan Wilcox
@danomatika
danomatika.com
robotcowboy.com





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20140307/85c29406/attachment-0001.htm>


More information about the Pd-dev mailing list