8209786: JDK12 fails to build on s390x with gcc 7.3
authoraleonard
Fri, 07 Sep 2018 11:24:59 +0200
changeset 51669 480486f31b3b
parent 51668 0a8d4f484987
child 51670 2dddc9394b49
8209786: JDK12 fails to build on s390x with gcc 7.3 Reviewed-by: ihse, goetz
make/lib/CoreLibraries.gmk
src/java.desktop/share/native/libmlib_image/mlib_ImageLookUp_Bit.c
--- a/make/lib/CoreLibraries.gmk	Fri Sep 07 08:14:47 2018 -0400
+++ b/make/lib/CoreLibraries.gmk	Fri Sep 07 11:24:59 2018 +0200
@@ -68,7 +68,7 @@
       CFLAGS_linux_ppc64le := -ffp-contract=off, \
       CFLAGS_linux_s390x := -ffp-contract=off, \
       CFLAGS_linux_aarch64 := -ffp-contract=off, \
-      DISABLED_WARNINGS_gcc := sign-compare misleading-indentation, \
+      DISABLED_WARNINGS_gcc := sign-compare misleading-indentation array-bounds, \
       DISABLED_WARNINGS_microsoft := 4146 4244 4018, \
       ARFLAGS := $(ARFLAGS), \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
--- a/src/java.desktop/share/native/libmlib_image/mlib_ImageLookUp_Bit.c	Fri Sep 07 08:14:47 2018 -0400
+++ b/src/java.desktop/share/native/libmlib_image/mlib_ImageLookUp_Bit.c	Fri Sep 07 11:24:59 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -259,18 +259,18 @@
       }
 
 #ifdef _LITTLE_ENDIAN
-      emask = (mlib_u32)((mlib_s32)(-1)) >> ((4 - (size - i)) * 8);
+      emask = (~(mlib_u32)0) >> ((4 - (size - i)) * 8);
 #else
-      emask = (mlib_s32)(-1) << ((4 - (size - i)) * 8);
+      emask = (~(mlib_u32)0) << ((4 - (size - i)) * 8);
 #endif /* _LITTLE_ENDIAN */
       ((mlib_u32*)da)[0] = (val1 & emask) | (((mlib_u32*)da)[0] &~ emask);
 
 #else /* _NO_LONGLONG */
 
 #ifdef _LITTLE_ENDIAN
-      mlib_u64 emask = (mlib_u64)((mlib_s64)(-1)) >> ((8 - (size - i)) * 8);
+      mlib_u64 emask = (~(mlib_u64)0) >> ((8 - (size - i)) * 8);
 #else
-      mlib_u64 emask = (mlib_s64)(-1) << ((8 - (size - i)) * 8);
+      mlib_u64 emask = (~(mlib_u64)0) << ((8 - (size - i)) * 8);
 #endif /* _LITTLE_ENDIAN */
 
       ((mlib_u64*)da)[0] = (((mlib_u64*)dd_array)[sa[0]] & emask) | (((mlib_u64*)da)[0] &~ emask);
@@ -395,9 +395,9 @@
       }
 
 #ifdef _LITTLE_ENDIAN
-      emask = (mlib_u32)((mlib_s32)(-1)) >> ((4 - (size - i)) * 8);
+      emask = (~(mlib_u32)0) >> ((4 - (size - i)) * 8);
 #else
-      emask = (mlib_s32)(-1) << ((4 - (size - i)) * 8);
+      emask = (~(mlib_u32)0) << ((4 - (size - i)) * 8);
 #endif /* _LITTLE_ENDIAN */
       ((mlib_u32*)da)[0] = (dd1 & emask) | (((mlib_u32*)da)[0] &~ emask);
 
@@ -413,9 +413,9 @@
       }
 
 #ifdef _LITTLE_ENDIAN
-      emask = (mlib_u64)((mlib_s64)(-1)) >> ((8 - (size - i)) * 8);
+      emask = (~(mlib_u64)0) >> ((8 - (size - i)) * 8);
 #else
-      emask = (mlib_s64)(-1) << ((8 - (size - i)) * 8);
+      emask = (~(mlib_u64)0) << ((8 - (size - i)) * 8);
 #endif /* _LITTLE_ENDIAN */
       ((mlib_u64*)da)[0] = (dd & emask) | (((mlib_u64*)da)[0] &~ emask);
 
@@ -565,9 +565,9 @@
       }
 
 #ifdef _LITTLE_ENDIAN
-      emask = (mlib_u32)((mlib_s32)(-1)) >> ((4 - (size - i)) * 8);
+      emask = (~(mlib_u32)0) >> ((4 - (size - i)) * 8);
 #else
-      emask = (mlib_s32)(-1) << ((4 - (size - i)) * 8);
+      emask = (~(mlib_u32)0) << ((4 - (size - i)) * 8);
 #endif /* _LITTLE_ENDIAN */
       da[0] = (dd & emask) | (da[0] &~ emask);
     }