Fix the problem of strict aliasing The strict-aliasing flag has been enabled in gcc. This leads to the following compiling error: yapa_fw_update.c:1136:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing] cc1: all warnings being treated as errors The term 'aliasing' indicates that pointers of different types point to the same memory address. The dereference of the type-punned pointer will lead to undefined behavior. In the particular problem here, it tries to type cast a char pointer to an integer pointer, and then dereferences the integer pointer. The solution is not to type cast different pointer types (except char pointer which is allowed in the strict aliasing rules). BUG=chromium-os:37931 TEST=Should emerge cypress-tools successfully. (cr) emerge-{BOARD} cypress-tools Change-Id: Id2c6fe668261383aa8b0f5824128abb1da65ce0e Reviewed-on: https://gerrit.chromium.org/gerrit/41354 Reviewed-by: Benson Leung <bleung@chromium.org> Commit-Queue: Joseph Shyh-In Hwang <josephsih@chromium.org> Tested-by: Joseph Shyh-In Hwang <josephsih@chromium.org>
1 file changed