compilation warning "dereferencing type-punned pointer.." in gcc 3.x or 4.x
I found warnings like followings in compiling with gcc 3.x or gcc 4.x.
../../src/share/javavm/native/java/security/AccessController.c|21| warning: dereferencing type-punned pointer will break strict-aliasing rules
CVMStackVal32 *arguments, CVMMethodBlock **p_mb)
CVMInt32 n = 0;
CVMArrayOfBooleanICell *isPrivilegedRef =
CVMArrayOfRefICell *contextRef =
[and several same warnings around sources]
I found the fact that unlike gcc 2.x, gcc 3.x or later versions use strict-aliasing for further optimization, when compiled with -O2, -O3, or -O4.
Should I use -fno-strict-aliasing to prevent optimization base on invalid assumption?
Or is it safe to ignore this warnings?