This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: dereferencing type-punned pointer will break strict-aliasing rules
- From: Andrew Haley <aph at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: howarth at bromo dot msbb dot uc dot edu (Jack Howarth), java at gcc dot gnu dot org
- Date: Thu, 12 Oct 2006 10:53:19 +0100
- Subject: Re: dereferencing type-punned pointer will break strict-aliasing rules
- References: <20060930195036.534B9F0049@bromo.msbb.uc.edu> <m37iz6tpny.fsf@localhost.localdomain>
Tom Tromey writes:
> >>>>> "Jack" == Jack Howarth <howarth@bromo.msbb.uc.edu> writes:
>
> Jack> Has anyone noticed that we are breaking the strict-aliasing ruls in
> Jack> natVMVirtualMachine.cc?
>
> Jack> Does this merit a bug report or how else should it be handled?
>
> Please file a bug report.
> Or fix it if you prefer :-)
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.