Skip to content
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

strict aliasing warning in EsifApplicationInterface.cpp #5

Open
vapier opened this issue Feb 10, 2014 · 1 comment
Open

strict aliasing warning in EsifApplicationInterface.cpp #5

vapier opened this issue Feb 10, 2014 · 1 comment

Comments

@vapier
Copy link

vapier commented Feb 10, 2014

building the project for CrOS yields this warning:

 * /build/x86-alex/tmp/portage/sys-power/dptf-8.0.5-r1/work/dptf-8.0.5/Products/DPTF/Sources/Manager/Manager/EsifApplicationInterface.cpp:86:65:
    warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

indeed the line in question is broken:

UInt32 getUInt32FromEsifDataGuidEvent(const esif::EsifDataPtr esifDataPtr) {
    ...
    UInt32 value = *((UInt32*)(esifDataGuidEvent->event_context));

probably want to use a union to avoid the issue

@dhegge
Copy link

dhegge commented Jan 23, 2016

I agree a union is definitely the way to fix this. Gotta love C it will let you force anything to happen.

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

No branches or pull requests

2 participants