[Bug c++/87289] jdk11 plinux compiled with gcc 7.3 doesn't work with NativeImageBuffer
bergner at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Sep 13 06:45:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87289
Peter Bergner <bergner at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |bergner at gcc dot gnu.org
Resolution|--- |INVALID
--- Comment #8 from Peter Bergner <bergner at gcc dot gnu.org> ---
(In reply to pdbain from comment #5)
> The compiler trips on this part of jnicsup.cpp (ca. line 500):
>
> #ifdef J9VM_INTERP_FLOAT_SUPPORT
> case 'F':
> /* float type */
> fltPtr = (jfloat*)--sp;
> /* The Linux SH4 compiler needs the next two lines to be two steps. If
> you combine them it fails to compile */
> dbl = ARG(jdouble, f);
> *fltPtr = (jfloat)dbl;
> break;
> case 'D':
> /* double type */
> dbl = ARG(jdouble, d);
> lngOrDblPtr = (UDATA *) &dbl;
> goto pushLongOrDouble;
> #endif
> case 'J':
> /* long type */
> lng = ARG(jlong, j);
> lngOrDblPtr = (UDATA *) &lng;
> pushLongOrDouble:
> #ifdef J9VM_ENV_DATA64
> --sp;
> *--sp = *(lngOrDblPtr);
> #else
> *--sp = *(lngOrDblPtr + 1);
> *--sp = *(lngOrDblPtr);
> #endif
> break;
I was able to create a small reproducer program and it shows you have a
-fstrict-aliasing bug in your source code. You take the address of the double
var "dbl" and cast its address to a UDATA * pointer and then use it. That
violates aliasing rules. I was able to get my small reproducer program to work
using the -fno-strict-aliasing option as well as using -O0 and -O1 where
-fstrict-aliasing is not enabled by default.
I'll note that a quick scan through pushArguments() shows other code that looks
to violate the aliasing rules too. You can either use -fno-strict-aliasing as
a work around or you will need to fix your code.
More information about the Gcc-bugs
mailing list