Re: devel/jdk: compile unsafe module with reduced optimization level

2018-05-28 Thread Mike Belopuhov
On Fri, May 25, 2018 at 14:07 -0400, Kurt Miller wrote:
> > Hi,
> > 
> > This appears to be the same issue as described here:
> > 
> >   https://bugs.openjdk.java.net/browse/JDK-8022407
> > 
> > that I can trigger with the following test case (SIGSEGV on a null
> > pointer):
> > 
> >   https://gist.github.com/mbelop/6ebb11d7e583562279abfb2e3b733fa5
> > 
> > Regards,
> > Mike
> 
> Thank Mike for the investigation, test case and patch!
> 
> I'm testing update 172b11 now with a slightly different version of the
> patch. I will commit this upstream and update the port this weekend.
>

Thanks, your work is greatly appreciated.

Your patch works for me as well.  I'm not certain about hardcoding
a Clang 6.0 version but I'll leave it to your discretion.

Cheers,
Mike

> -Kurt
> 
> diff -r 749852fe39a6 make/bsd/makefiles/gcc.make
> --- a/make/bsd/makefiles/gcc.make   Sat May 19 23:14:15 2018 -0700
> +++ b/make/bsd/makefiles/gcc.make   Fri May 25 13:56:03 2018 -0400
> @@ -328,6 +328,9 @@
>  OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
>  OPT_CFLAGS/unsafe.o += -O1
>    endif
> +  ifeq ($(shell expr $(CC_VER_MAJOR) = 6 \& $(CC_VER_MINOR) = 0), 1)
> +OPT_CFLAGS/unsafe.o += -O1
> +  endif
>  else
>    # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized
> compilation.
>    ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1)
> 
> 



Re: devel/jdk: compile unsafe module with reduced optimization level

2018-05-25 Thread Kurt Miller
> Hi,
> 
> This appears to be the same issue as described here:
> 
>   https://bugs.openjdk.java.net/browse/JDK-8022407
> 
> that I can trigger with the following test case (SIGSEGV on a null
> pointer):
> 
>   https://gist.github.com/mbelop/6ebb11d7e583562279abfb2e3b733fa5
> 
> Regards,
> Mike

Thank Mike for the investigation, test case and patch!

I'm testing update 172b11 now with a slightly different version of the
patch. I will commit this upstream and update the port this weekend.

-Kurt

diff -r 749852fe39a6 make/bsd/makefiles/gcc.make
--- a/make/bsd/makefiles/gcc.make   Sat May 19 23:14:15 2018 -0700
+++ b/make/bsd/makefiles/gcc.make   Fri May 25 13:56:03 2018 -0400
@@ -328,6 +328,9 @@
 OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
 OPT_CFLAGS/unsafe.o += -O1
   endif
+  ifeq ($(shell expr $(CC_VER_MAJOR) = 6 \& $(CC_VER_MINOR) = 0), 1)
+OPT_CFLAGS/unsafe.o += -O1
+  endif
 else
   # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized
compilation.
   ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1)




devel/jdk: compile unsafe module with reduced optimization level

2018-05-25 Thread Mike Belopuhov
Hi,

This appears to be the same issue as described here:

  https://bugs.openjdk.java.net/browse/JDK-8022407

that I can trigger with the following test case (SIGSEGV on a null pointer):

  https://gist.github.com/mbelop/6ebb11d7e583562279abfb2e3b733fa5

Regards,
Mike

Index: devel/jdk/1.8/patches/patch-hotspot_make_bsd_makefiles_gcc_make
===
RCS file: devel/jdk/1.8/patches/patch-hotspot_make_bsd_makefiles_gcc_make
diff -N devel/jdk/1.8/patches/patch-hotspot_make_bsd_makefiles_gcc_make
--- /dev/null   1 Jan 1970 00:00:00 -
+++ devel/jdk/1.8/patches/patch-hotspot_make_bsd_makefiles_gcc_make 25 May 
2018 16:08:02 -
@@ -0,0 +1,23 @@
+$OpenBSD$
+
+Make the fix for 8022407 available on all Clang versions.
+
+8022407: sun/misc/CopyMemory.java fails with SIGSEGV in Unsafe_SetByte+0x35
+Summary: lower optimization level for unsafe.cpp due to MacOS Xcode 4.6.2 
compiler optimization issue.
+
+Index: hotspot/make/bsd/makefiles/gcc.make
+--- hotspot/make/bsd/makefiles/gcc.make.orig
 hotspot/make/bsd/makefiles/gcc.make
+@@ -320,10 +320,8 @@ OPT_CFLAGS/NOOPT=-O0
+ 
+ # Work around some compiler bugs.
+ ifeq ($(USE_CLANG), true)
+-  ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1)
+-OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
+-OPT_CFLAGS/unsafe.o += -O1
+-  endif
++  OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
++  OPT_CFLAGS/unsafe.o += -O1
+ else
+   # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation.
+   ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1)