I wish to call fftw's in-place real-to-complex transform function, which has the following signature:
fftw_plan fftw_plan_dft_r2c_1d(
int n, // transform length
double* in, // pointer to input array
fftw_complex* out, // pointer to output array
unsigned flags // flags
);
The documentation says that I should indicate that I wish to perform an in-place transform by passing in aliasing pointers for the in
and out
parameters.
QUESTION: How can in
and out
alias without violating strict aliasing rules?
I am open to GCC-specific extensions (i.e., using union
s to do type-punning, even though the standard declares this to be undefined behavior). Even if this extension is permitted, a union cannot contain dynamically-sized arrays (which is a must in this applications - I do not know the transform length in advance). Does anyone have any ideas? Thanks in advance.
-fno-strict-aliasing
)? – Etheline