Skip to content

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

Open
polluxsynth wants to merge 1 commit intomborgerding:masterfrom
polluxsynth:fix-alignment-warning
Open

Fix alignment warning when building with -Wcast-align#42
polluxsynth wants to merge 1 commit intomborgerding:masterfrom
polluxsynth:fix-alignment-warning

Conversation

@polluxsynth
Copy link

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

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 polluxsynth force-pushed the fix-alignment-warning branch from fb1b9bb to 31018ea Compare April 22, 2020 10:09
@polluxsynth polluxsynth changed the title Fix alignment warning when building with --Wcast-align Fix alignment warning when building with -Wcast-align Apr 22, 2020
Copy link
Owner

@mborgerding mborgerding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From which compiler did you see the warning?

@bsupnik , would this commit undo the alignment from pull request #41

@polluxsynth
Copy link
Author

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
Copy link
Owner

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
Copy link
Author

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
Copy link

seanm commented Sep 23, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants