New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compilation errors because of references to packed struct members #47
Comments
@nfont could you take a look on this issue? -Waddress-of-packed-member is enabled by default with gcc-9, so it seems that amd_sgpio code has to be refactored to not use pointers to members of packed structures. |
I've consulted this with people who know more than I do about this topic and I was told that the code itself should be safe, as architectures that do not support unaligned memory accesses are rare. However, I still think it's better to not use them, unless there is a really strong reason to do so, which I can't even think of and, in my opinion, is not the case here. |
I can take a look at updating the amd code. The use of the packed structures were to keep the compiler from padding any of the structures so they can be written directly to the sysfs file. |
The use of packed structures is not a problem. The problem is the use of references to the members of those structures in function calls. Having a function(s) that take(s) a reference to the entire structure and then deal(s) with the members inside should be fine. |
Hello @nfont do you have any progress on this issue? Regards, |
New compiler versions might output new warnings by default (see #47 for an example), which makes -Werror problematic for distributions. The more specific -Werror= settings are usually not a problem. The warnings are still shown, but they will no longer break the build. Signed-off-by: Adrian Bunk <bunk@debian.org>
I have code that I have been testing and will get a pull request put together this afternoon. |
I opened pull request #52 to resolve this issue. |
With gcc 9.2.1, I'm getting a lot of these during the compilation of ledmon-0.93:
To be honest, I don't know if such references are even supposed to work, but I can imagine that the generated code might act funny on architectures like ppc64.
The text was updated successfully, but these errors were encountered: