A test case for issue #40. Segfaults with: make -C test test_simd && ./test/test_simd

This commit is contained in:
Mark Borgerding 2020-04-19 09:57:40 -04:00
parent c2c0c0be03
commit b30b93cd97
3 changed files with 28 additions and 0 deletions

1
.gitignore vendored
View File

@ -44,3 +44,4 @@ tools/fft_float
tools/fft_int16_t
tools/fft_int32_t
tools/fft_simd
test/test_simd

View File

@ -64,6 +64,8 @@ all: tools $(BENCHKISS) $(SELFTEST) $(BENCHFFTW) $(TESTREAL) $(TESTKFC)
tools:
cd ../tools && make all
test_simd: test_simd.c $(SRCFILES)
$(CC) -o $@ -g $(CFLAGS) -DUSE_SIMD=1 -msse $+ -lm
$(SELFTEST): $(SELFTESTSRC) $(SRCFILES)
$(CC) -o $@ $(CFLAGS) $(TYPEFLAGS) $+ -lm

25
test/test_simd.c Normal file
View File

@ -0,0 +1,25 @@
#include <kiss_fftnd.h>
static void test1(void)
{
int is_inverse = 1;
int n[2] = {256,256};
size_t nbytes = sizeof(kiss_fft_cpx)*n[0]*n[1];
kiss_fft_cpx * inbuf = _mm_malloc(nbytes,16);
kiss_fft_cpx * outbuf = _mm_malloc(nbytes,16);
memset(inbuf,0,nbytes);
memset(outbuf,0,nbytes);
kiss_fftnd_cfg cfg = kiss_fftnd_alloc(n,2,is_inverse,0,0);
kiss_fftnd(cfg,inbuf,outbuf);
kiss_fft_free(cfg);
_mm_free(inbuf);
_mm_free(outbuf);
}
int main(void)
{
test1();
return 0;
}