RFR: JDK-8160353: narrowing conversion error is occurred with GCC 6
Yasumasa Suenaga
yasuenag at gmail.com
Tue Jun 28 03:36:16 UTC 2016
Hi Kim,
> I would prefer that compiler configuration issue got fixed and these kinds of issues be deferred to a future modernization project.
IMHO, src/os/linux/vm/os_linux.cpp should be fixed at least because elf_class
and endianess is defined as unsigned char.
In other point, I confirmed that we can avoid -std=gnu++98 as below:
-----------
diff -r ba08710f3b6c make/lib/CompileJvm.gmk
--- a/make/lib/CompileJvm.gmk Mon Jun 27 09:35:18 2016 +0200
+++ b/make/lib/CompileJvm.gmk Tue Jun 28 12:10:09 2016 +0900
@@ -187,6 +187,11 @@
JVM_OPTIMIZATION ?= HIGHEST_JVM
+JVM_CXXFLAGS := $(JVM_CFLAGS)
+ifeq ($(TOOLCHAIN_TYPE), gcc)
+ JVM_CXXFLAGS += -std=gnu++98 -fno-delete-null-pointer-checks -fno-lifetime-dse
+endif
+
################################################################################
# Now set up the actual compilation of the main hotspot native library
@@ -202,6 +207,7 @@
CFLAGS := $(JVM_CFLAGS), \
CFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
CXXFLAGS_DEBUG_SYMBOLS := $(JVM_CFLAGS_SYMBOLS), \
+ CXXFLAGS := $(JVM_CXXFLAGS), \
vm_version.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
DISABLED_WARNINGS_clang := delete-non-virtual-dtor dynamic-class-memaccess \
empty-body format logical-op-parentheses parentheses \
-----------
Can I send this change as review request of JDK-8156980?
Thanks,
Yasumasa
On 2016/06/28 3:12, Kim Barrett wrote:
>> On Jun 27, 2016, at 10:26 AM, Yasumasa Suenaga <yasuenag at gmail.com> wrote:
>>
>> Hi all,
>>
>> This review request relates to JDK-8160310: HotSpot cannot be built with GCC 6 .
>>
>> I encountered narrowing conversion error when I compiled OpenJDK 9 with GCC 6
>> on Fedora 24 x64.
>> I think these error should be fixed.
>>
>> I uploaded webrev.
>> Could you review it?
>>
>> http://cr.openjdk.java.net/~ysuenaga/JDK-8160353/webrev.00/
>
> The warnings being encountered here are all a result of attempting to build a code base written for C++98 with a C++11 (or later) compiler. C++11 made an incompatible change to aggregate initialization, forbidding implicit narrowing conversions. A few months ago a change was made to explicitly use -std=gnu++98 for exactly this reason (see JDK-8151841), but that seems to have gotten lost in the transition to the new build system (see JDK-8156980).
>
> I would prefer that compiler configuration issue got fixed and these kinds of issues be deferred to a future modernization project.
>
More information about the hotspot-dev
mailing list