dereferencing type-punned pointer will break strict-aliasing rules

Jack Howarth howarth@bromo.msbb.uc.edu
Thu Oct 12 23:05:00 GMT 2006


Andrew,
     I wonder why it only produces a single warning...

../../../gcc-4.2-20060928/libjava/gnu/classpath/jdwp/natVMVirtualMachine.cc:46: warning: dereferencing type-punned pointer will break strict-aliasing rules

if the problem exists throughout the libjava sources? Or do
you seem more occurances on your architecture?
                Jack


On Thu, Oct 12, 2006 at 10:53:19AM +0100, Andrew Haley wrote:
> This evil is all over the place:
> 
>   JNIEnv *env;
>   vm->GetEnv((void **)&env, JNI_VERSION_1_1);
> 
> [ FWIW, The JNI version of GetEnv looks like this:
> 
> Prototype  jint GetEnv(JavaVM *vm, void **penv, jint interface_id);
> 
> Description  If the current thread is not attached to the given virtual
> machine instance, sets *penv to NULL, and returns JNI_EDETACHED. If
> the specified interface is not supported, sets *penv to NULL, and
> returns JNI_EVERSION. Otherwise, sets *env to the appropriate
> interface, and returns JNI_OK. ]
> 
> We probably ned to go over the whole gcj tree and fix them all.  :-(
> 
> Andrew.



More information about the Java mailing list