mborgerding / kissfft

a Fast Fourier Transform (FFT) library that tries to Keep it Simple, Stupid
Other
1.39k stars 278 forks source link

Fix alignment warning when building with -Wcast-align #42

Open polluxsynth opened 4 years ago

polluxsynth commented 4 years ago

When building with -Wcast-align, we get a warning because the alignment of st->substate is not known by kiss_fftr_alloc() so shift the data around so that we don't need to care about the alignment for st->substate.

Signed-off-by: Ricard Wanderlof ricardw@axis.com

polluxsynth commented 4 years ago

gcc 8.3.0

Note however, that as I mentioned in the commit message, that the warning only occurs when enabling the compiler switch -Wcast-align, which isn't enabled in the Makefile in the library, however, it is enabled in the code that I was using the library in.

All the patch does is move the various chunks of data around in the single allocated area so that the substate is at the end of the allocated area, where it's not important what size it is.

mborgerding commented 4 years ago

Strange. I see no such warning with gcc 8.3.1 (CentOS 8 stream).

Not sure about the Makefile you are using to compile it, but -Wcast-align is used in both test/Makefile and tools/Makefile.

polluxsynth commented 4 years ago

That's interesting. (I honestly hadn't looked at the tools/ and test/ Makefiles, just a quick glance at the top level one).

I wonder if it could be CPU dependent? I'm building for ARM (Cortex-A9).

seanm commented 2 years ago

I saw these warnings too fixing some others here but fixing them looks non-trivial.