JDK-8253239 : Disable VS warning C4307
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 16
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • CPU: generic
  • Submitted: 2020-09-16
  • Updated: 2024-11-22
  • Resolved: 2020-09-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 16
16 b17Fixed
Related Reports
Duplicate :  
Relates :  
Description
When building with VS2017,  the build currently fails with :

> ./test/hotspot/gtest/utilities/test_align.cpp(96): error C2220: warning treated as error - no 'object' file generated
> ./test/hotspot/gtest/utilities/test_align.cpp(156): note: see reference to function template instantiation 'void static_test_alignments<T,A>(void)' being compiled
>         with
>         [
>             T=int64_t,
>             A=uint8_t
>         ]
> ./test/hotspot/gtest/utilities/test_align.cpp(162): note: see reference to function template instantiation 'void test_alignments<int64_t,uint8_t>(void)' being compiled
> ./test/hotspot/gtest/utilities/test_align.cpp(96): warning C4307: '+': integral constant overflow
>  
>  

This might be related to an issue fixed  at least in some versions of VS2019 , that is discussed here :

https://developercommunity.visualstudio.com/content/problem/211134/unsigned-integer-overflows-in-constexpr-functionsa.html

This problem has already come up elsewhere, see :  8253089: Windows (MSVC 2017) build fails after JDK-8243208
So it might be a good idea to disable the warning .

Comments
Changeset: 52c28b86 Author: Matthias Baesken <mbaesken@openjdk.org> Date: 2020-09-18 14:06:29 +0000 URL: https://git.openjdk.java.net/jdk/commit/52c28b86
18-09-2020

disabling the warning for VS2017 worked for me, I think building with older versions of VS does not work any more anyway so no need to handle them . diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4 index 64f9883d52e..db8062c34e4 100644 --- a/make/autoconf/flags-cflags.m4 +++ b/make/autoconf/flags-cflags.m4 @@ -134,6 +134,9 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS], WARNINGS_ENABLE_ALL="-W3" DISABLED_WARNINGS="4800" + if test "x$TOOLCHAIN_VERSION" = x2017; then + DISABLED_WARNINGS+=" 4307" + fi ;;
18-09-2020

Assigning to Matthias since he has ready access to VS2017 (many of us don't).
16-09-2020