On Fri, Jan 28, 2011 at 3:00 AM, Gabriel M. Beddingfield
<gabrbedd(a)gmail.com> wrote:
Hi James,
You always know how to nerd snipe me!
On Thursday, January 27, 2011 06:35:08 pm James Stone wrote:
I have been working on the Neil tracker program
recently,
and hit a weird bug that seems to affect only my
computer! I get a segfault when trying to use fft.h
Not just you. It segfaults for me, too. Ubuntu 10.04 with Core Duo
processor.
With the patch below (to fft.h) I detect that p2r and p2i overrun the
buffer when k==11, j==0, i==0. However, k was supposed to STOP when
it reached 11 = log(2048)/log(2).
My guess is that is that the integer k is promoted to a float and the
comparison is performed. When I replace:
for (k = 0, le = 2; k < log(fftFrameSize)/log(2.); k++) {
with:
long ITERS = log(fftFrameSize)/log(2.0) + 0.5;
for (k = 0, le = 2; k < ITERS; k++) {
...the code doesn't crash on me. Here's a sample program that
illustrates what's happening.