On Wed, 03 Jan 2007 10:06:37 +0100
Sebastian Schäfer <[EMAIL PROTECTED]> wrote:

[stuff removed]

> I applied the changes mentioned above and stumbled over one very curious
> thing:
> The following is the output of gcc when compiling the plugin:
> 
> ---------------------
>  gcc -DHAVE_CONFIG_H -I. -I. -I. -I/usr/local/include -g -O2 -Wall -O6
> -fomit-frame-pointer -fstrength-reduce -funroll-loops -ffast-math -fPIC
> -DPIC -march=i686 -MT mbeq_119700_la-mbeq_119700.lo -MD -MP
> -MF .deps/mbeq_119700_la-mbeq_119700.Tpo -c mbeq_119700.c  -fPIC -DPIC
> -o .libs/mbeq_119700_la-mbeq_119700.o
> mbeq_119700.c: In function 'runMChMBEq':
> mbeq_119700.c:3893: warning: operation on 'comp_rp_ptr_L' may be
> undefined
> mbeq_119700.c:3894: warning: operation on 'comp_ip_ptr_L' may be
> undefined
> mbeq_119700.c:3896: warning: operation on 'comp_rp_ptr_R' may be
> undefined
> mbeq_119700.c:3897: warning: operation on 'comp_ip_ptr_R' may be
> undefined
> mbeq_119700.c:3899: warning: operation on 'comp_rp_ptr_C' may be
> undefined
> mbeq_119700.c:3900: warning: operation on 'comp_ip_ptr_C' may be
> undefined
> mbeq_119700.c:3902: warning: operation on 'comp_rp_ptr_S' may be
> undefined
> mbeq_119700.c:3903: warning: operation on 'comp_ip_ptr_S' may be
> undefined
> mbeq_119700.c:3905: warning: operation on 'comp_rp_ptr_LS' may be
> undefined
> mbeq_119700.c:3906: warning: operation on 'comp_ip_ptr_LS' may be
> undefined
> mbeq_119700.c:3908: warning: operation on 'comp_rp_ptr_RS' may be
> undefined
> mbeq_119700.c:3909: warning: operation on 'comp_ip_ptr_RS' may be
> undefined
> mbeq_119700.c: In function 'runMChMBEq':
> mbeq_119700.c:3893: warning: operation on 'comp_rp_ptr_L' may be
> undefined
> mbeq_119700.c:3894: warning: operation on 'comp_ip_ptr_L' may be
> undefined
> mbeq_119700.c:3896: warning: operation on 'comp_rp_ptr_R' may be
> undefined
> mbeq_119700.c:3897: warning: operation on 'comp_ip_ptr_R' may be
> undefined
> mbeq_119700.c:3899: warning: operation on 'comp_rp_ptr_C' may be
> undefined
> mbeq_119700.c:3900: warning: operation on 'comp_ip_ptr_C' may be
> undefined
> mbeq_119700.c:3902: warning: operation on 'comp_rp_ptr_S' may be
> undefined
> mbeq_119700.c:3903: warning: operation on 'comp_ip_ptr_S' may be
> undefined
> mbeq_119700.c:3905: warning: operation on 'comp_rp_ptr_LS' may be
> undefined
> mbeq_119700.c:3906: warning: operation on 'comp_ip_ptr_LS' may be
> undefined
> mbeq_119700.c:3908: warning: operation on 'comp_rp_ptr_RS' may be
> undefined
> mbeq_119700.c:3909: warning: operation on 'comp_ip_ptr_RS' may be
> undefined
> ------------------
> 
> As you can see, it complains _twice_ about errors/warnings in the same
> function! I don't think this is right and as the segfault occurs in
> exactly the function gcc complains about I think this is somehow
> connected...
> 

I do pay attention to such warnings, but I think in this case they are
bogus. Let's have a look at 'comp_rp_ptr_L', for example - please have a look at
output of 'grep':

"
[243] 11:16 [EMAIL PROTECTED]:/ibm/home/sergei> grep -n comp_rp_ptr_L 
swh-plugins/swh-plugins-0.4.11/mbeq_119700.c
3554:      fftw_real *comp_rp_ptr_L = comp_L + 1;
3579:          *comp_rp_ptr_L++ = *comp_rp_ptr_L * cos_times_gain;
[244] 11:16 [EMAIL PROTECTED]:/ibm/home/sergei> grep -n comp_L 
swh-plugins/swh-plugins-0.4.11/mbeq_119700.c
254:  fftw_real     *comp_L;
466:  free((*plugin_data).comp_L);
771:  CALLOC_AND_CHECK(fftw_real *, (*plugin_data).comp_L, fft_length, 
sizeof(fftw_real), __LINE__)
788:  (*plugin_data).plan_rc_L = fftwf_plan_r2r_1d(fft_length, 
(*plugin_data).real_L, (*plugin_data).comp_L, FFTW_R2HC, FFTW_MEASURE);
789:  (*plugin_data).plan_cr_L = fftwf_plan_r2r_1d(fft_length, 
(*plugin_data).comp_L, (*plugin_data).real_L, FFTW_HC2R, FFTW_MEASURE);
1607:  fftw_real *comp_L = (*plugin_data).comp_L;
3542:      rfftw_one(plan_rc, real_L, comp_L);
3552:      //fprintf(stderr, "just after direct FFT: *(comp_L + 
input_buffer_pos)=%G\n", (LADSPA_Data)(*(comp_L + input_buffer_pos)));
3554:      fftw_real *comp_rp_ptr_L = comp_L + 1;
3556:      // in comp_L array - DC is left intact
3558:      fftw_real *comp_ip_ptr_L = comp_L + fft_length - 1;
3559:      // the above is imaginary part pointer - end of comp_L array
3592:      //fprintf(stderr, "just after multiplying by gain: *(comp_L + 
input_buffer_pos)=%G\n", (LADSPA_Data)(*(comp_L + input_buffer_pos)));
3601:      rfftw_one(plan_cr, comp_L, real_L);
[245] 11:16 [EMAIL PROTECTED]:/ibm/home/sergei>    
".

The

3554:      fftw_real *comp_rp_ptr_L = comp_L + 1;

line says that at the moment 'comp_rp_ptr_L' is created it gets its value from
'comp_L'.

'comp_L' gets initialized by

771:  CALLOC_AND_CHECK(fftw_real *, (*plugin_data).comp_L, fft_length, 
sizeof(fftw_real), __LINE__)

and '(*plugin_data).comp_L' is copied later into the 'comp_L' in question:

1607:  fftw_real *comp_L = (*plugin_data).comp_L;

So, as I see it, the chain of defined value passing is:

771:  CALLOC_AND_CHECK(fftw_real *, (*plugin_data).comp_L, fft_length, 
sizeof(fftw_real), __LINE__) ->
1607:  fftw_real *comp_L = (*plugin_data).comp_L; ->
3554:      fftw_real *comp_rp_ptr_L = comp_L + 1; ->
3579:          *comp_rp_ptr_L++ = *comp_rp_ptr_L * cos_times_gain;

...

A stray thought - try '-O0' in gcc, i.e. no optimization - I recently fixed
a non-crash problem using '-O0'.

Regards,
  Sergei.

-- 
Visit my http://appsfromscratch.berlios.de/ open source project.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-user mailing list
Alsa-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-user

Reply via email to