we should either fix interpret.cc or compile it with -fno-strict-aliasing. Andrew points out that it has code like this in it: jbyte value = (*(jint*)&rvalue) & 0xff;
Confirmed, it would look nicer if you used a union also as then you can refer to the types by nice variable names like double_value and such like that. This is in _Jv_InterpMethod::run.
Subject: Bug 15713 CVSROOT: /cvs/gcc Module name: gcc Changes by: bryce@gcc.gnu.org 2004-07-13 01:04:48 Modified files: libjava : ChangeLog interpret.cc libjava/include: jvm.h libjava/gcj : field.h Log message: 2004-07-12 Bryce McKinlay <mckinlay@redhat.com> PR libgcj/15713 * include/jvm.h (_Jv_value): New union type. * gcj/field.h (_Jv_Field): Add new _addr union field variants * interperet.cc (run): Use _Jv_value union type and *_addr _Jv_Field union members. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.2924&r2=1.2925 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/interpret.cc.diff?cvsroot=gcc&r1=1.42&r2=1.43 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/include/jvm.h.diff?cvsroot=gcc&r1=1.65&r2=1.66 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gcj/field.h.diff?cvsroot=gcc&r1=1.9&r2=1.10
Fixed.