RFR: 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
Fri Jul 6 09:54:02 UTC 2018


Hi,

I'd like to get a review of this change for 8u:

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

This is part of getting jdk8u to accept later Windows compilers. Not 
changing the code, but adding a conditional  #pragma to let the compiler 
accept the code.

I'll include a diff in text below (can do a webrev if anybody would like 
one...).

Many thanks!
Kevin


bash-4.2$ hg diff src/os_cpu/windows_x86/vm/os_windows_x86.cpp
diff -r 5792d995ed26 src/os_cpu/windows_x86/vm/os_windows_x86.cpp
--- a/src/os_cpu/windows_x86/vm/os_windows_x86.cpp      Wed Jun 27 
03:04:33 2018 -0700
+++ b/src/os_cpu/windows_x86/vm/os_windows_x86.cpp      Fri Jul 06 
02:46:48 2018 -0700
@@ -454,11 +454,19 @@
  // 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( push )
+#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( pop )
+#endif
  #else
  // Returns the current stack pointer. Accurate value needed for
  // os::verify_stack_alignment().





More information about the hotspot-dev mailing list