8199782: Fix compilation warnings detected by Solaris Developer Studio 12.6
authorgadams
Thu, 05 Apr 2018 11:18:39 -0700
changeset 49678 fa26e7c6efb7
parent 49677 a1a7456dd8b9
child 49679 7084eec5c723
8199782: Fix compilation warnings detected by Solaris Developer Studio 12.6 Reviewed-by: sspitsyn, dholmes, ihse
make/hotspot/lib/CompileJvm.gmk
src/java.base/solaris/native/libjvm_db/libjvm_db.c
test/fmw/gtest/src/gtest.cc
test/hotspot/jtreg/runtime/libadimalloc.solaris.sparc/liboverflow.c
--- a/make/hotspot/lib/CompileJvm.gmk	Thu Apr 05 13:19:25 2018 -0400
+++ b/make/hotspot/lib/CompileJvm.gmk	Thu Apr 05 11:18:39 2018 -0700
@@ -181,6 +181,11 @@
   else ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
     JVM_CFLAGS += $(TOPDIR)/src/hotspot/os_cpu/solaris_sparc/solaris_sparc.il
   endif
+  # Exclude warnings in devstudio 12.6
+  ifeq ($(CC_VERSION_NUMBER), 5.15)
+    DISABLED_WARNINGS_solstudio := SEC_ARR_OUTSIDE_BOUND_READ \
+      SEC_ARR_OUTSIDE_BOUND_WRITE
+  endif
 endif
 
 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), solaris-sparcv9)
@@ -223,6 +228,7 @@
     vm_version.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
     arguments.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
     DISABLED_WARNINGS_clang := tautological-compare, \
+    DISABLED_WARNINGS_solstudio := $(DISABLED_WARNINGS_solstudio), \
     DISABLED_WARNINGS_xlc := 1540-0216 1540-0198 1540-1090 1540-1639 \
         1540-1088 1500-010, \
     ASFLAGS := $(JVM_ASFLAGS), \
--- a/src/java.base/solaris/native/libjvm_db/libjvm_db.c	Thu Apr 05 13:19:25 2018 -0400
+++ b/src/java.base/solaris/native/libjvm_db/libjvm_db.c	Thu Apr 05 11:18:39 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, 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
@@ -1393,6 +1393,7 @@
     bcp          = (uintptr_t) regs[R_L1];
     methodPtr = (uintptr_t) regs[R_L2];
     sender_sp = regs[R_I5];
+    fp = (uintptr_t) regs[R_FP];
     if (debug > 2) {
         fprintf(stderr, "\nregs[R_I1]=%lx, regs[R_I2]=%lx, regs[R_I5]=%lx, regs[R_L1]=%lx, regs[R_L2]=%lx\n",
                          regs[R_I1], regs[R_I2], regs[R_I5], regs[R_L1], regs[R_L2]);
--- a/test/fmw/gtest/src/gtest.cc	Thu Apr 05 13:19:25 2018 -0400
+++ b/test/fmw/gtest/src/gtest.cc	Thu Apr 05 11:18:39 2018 -0700
@@ -49,6 +49,9 @@
 #include <ostream>  // NOLINT
 #include <sstream>
 #include <vector>
+#if defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x5140
+#pragma error_messages(off, SEC_NULL_PTR_DEREF)
+#endif
 
 #if GTEST_OS_LINUX
 
--- a/test/hotspot/jtreg/runtime/libadimalloc.solaris.sparc/liboverflow.c	Thu Apr 05 13:19:25 2018 -0400
+++ b/test/hotspot/jtreg/runtime/libadimalloc.solaris.sparc/liboverflow.c	Thu Apr 05 11:18:39 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -26,6 +26,9 @@
 #include <string.h>
 #include <unistd.h>
 #include <jni.h>
+#if defined (__SUNPRO_C) && __SUNPRO_C >= 0x5140
+#pragma error_messages(off, SEC_ARR_OUTSIDE_BOUND_READ)
+#endif
 
 #ifdef __cplusplus
 extern "C" {