kissfft icon indicating copy to clipboard operation
kissfft copied to clipboard

Fix alignment warning when building with -Wcast-align

Open polluxsynth opened this issue 5 years ago • 4 comments

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 [email protected]

polluxsynth avatar Apr 22 '20 10:04 polluxsynth

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.

polluxsynth avatar Apr 22 '20 11:04 polluxsynth

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.

mborgerding avatar Apr 22 '20 13:04 mborgerding

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).

polluxsynth avatar Apr 22 '20 22:04 polluxsynth

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

seanm avatar Sep 23 '21 17:09 seanm