[8u-dev] Request for approval: 8206454: [8u] os::current_stack_pointer() fails to compile on later Windows compilers (warning C4172: returning address of local variable)

Kevin Walls kevin.walls at oracle.com
Mon Jul 9 11:32:10 UTC 2018


Hi,

I'd like to request approval for 8u for this small new fix which helps 
enable use of different/later Windows compilers:

8206454: [8u] os::current_stack_pointer() fails to compile on later 
Windows compilers (warning C4172: returning address of local variable) 
https://bugs.openjdk.java.net/browse/JDK-8206454

hotspot-dev review: 
http://mail.openjdk.java.net/pipermail/hotspot-dev/2018-July/033453.html

The 8u diff proposal is below.

Many thanks!
Kevin


bash-4.2$ hg diff
diff -r ad057f2e3211 src/os_cpu/windows_x86/vm/os_windows_x86.cpp
--- a/src/os_cpu/windows_x86/vm/os_windows_x86.cpp      Wed Jul 04 
03:02:43 2018 -0400
+++ b/src/os_cpu/windows_x86/vm/os_windows_x86.cpp      Mon Jul 09 
01:10:18 2018 -0700
@@ -454,11 +454,18 @@
  // Returns an estimate of the current stack pointer. Result must be 
guaranteed
  // to point into the calling threads stack, and be no lower than the 
current
  // stack pointer.
+#if defined(_MSC_VER) && _MSC_VER >= 1900
+// warning C4172: returning address of local variable or temporary: dummy
+#pragma warning(disable: 4172)
+#endif
  address os::current_stack_pointer() {
    int dummy;
    address sp = (address)&dummy;
    return sp;
  }
+#if defined(_MSC_VER) && _MSC_VER >= 1900
+#pragma warning(default: 4172)
+#endif
  #else
  // Returns the current stack pointer. Accurate value needed for
  // os::verify_stack_alignment().


More information about the jdk8u-dev mailing list