RFR (S): 8143215: gcc 4.1.2: fix three issues breaking the build.

Lindenmaier, Goetz goetz.lindenmaier at sap.com
Fri Nov 20 08:24:29 UTC 2015


Hi Kim,

No, -Wno-conversion does not help.  This must be a bug in gcc, but I could not find
any useful information to that.  I also understand the docu of -Wconversion that 
it should affect this warning. 

Best regards,
  Geotz

g++ -DLINUX -D_GNU_SOURCE -DPPC64 -DASSERT -I/sapmnt/home1/d045726/oJ/8143215-gcc412-hs-rt/src/share/vm/prims -I/sapmnt/home1/d045726/oJ/8143215-gcc412-hs-rt/src/share/vm -I/sapmnt/home1/d045726/oJ/8143215-gcc412-hs-rt/src/share/vm/precompiled -I/sapmnt/home1/d045726/oJ/8143215-gcc412-hs-rt/src/cpu/ppc/vm -I/sapmnt/home1/d045726/oJ/8143215-gcc412-hs-rt/src/os_cpu/linux_ppc/vm -I/sapmnt/home1/d045726/oJ/8143215-gcc412-hs-rt/src/os/linux/vm -I/sapmnt/home1/d045726/oJ/8143215-gcc412-hs-rt/src/os/posix/vm -I../generated -DHOTSPOT_BUILD_USER="d045726" -DHOTSPOT_LIB_ARCH=ppc64 -DHOTSPOT_VM_DISTRO="OpenJDK" -DTARGET_OS_FAMILY_linux -DTARGET_ARCH_ppc -DTARGET_ARCH_MODEL_ppc_64 -DTARGET_OS_ARCH_linux_ppc -DTARGET_OS_ARCH_MODEL_linux_ppc_64 -DTARGET_COMPILER_gcc -DCOMPILER2 -DINCLUDE_JVMCI=0 -DDONT_USE_PRECOMPILED_HEADER -fPIC -fno-rtti -fno-exceptions -D_REENTRANT -fcheck-new -m64 -pipe -fno-strict-aliasing -fno-omit-frame-pointer -O0 -g -fstack-protector-all --param ssp-buffer-size=1 -D_NMT_NOINLINE_ -D_LP64=1 -mminimal-toc -mcpu=powerpc64 -mtune=power5 -minsert-sched-nops=regroup_exact -mno-multiple -mno-string -Werror -Wno-conversion -c -MMD -MP -MF ../generated/dependencies/g1CollectorPolicy.o.d -fpch-deps -o g1CollectorPolicy.o /sapmnt/home1/d045726/oJ/8143215-gcc412-hs-rt/src/share/vm/gc/g1/g1CollectorPolicy.cpp
cc1plus: warnings being treated as errors
/sapmnt/home1/d045726/oJ/8143215-gcc412-hs-rt/src/share/vm/gc/g1/g1CollectorPolicy.cpp: In member function ‘bool G1CollectorPolicy::predict_will_fit(uint, double, uint, double) const’:
/sapmnt/home1/d045726/oJ/8143215-gcc412-hs-rt/src/share/vm/gc/g1/g1CollectorPolicy.cpp:479: warning: converting to ‘size_t’ from ‘double’

-----Original Message-----
From: Kim Barrett [mailto:kim.barrett at oracle.com] 
Sent: Friday, November 20, 2015 2:05 AM
To: Lindenmaier, Goetz <goetz.lindenmaier at sap.com>
Cc: hotspot-gc-dev at openjdk.java.net
Subject: Re: RFR (S): 8143215: gcc 4.1.2: fix three issues breaking the build.

On Nov 19, 2015, at 4:44 AM, Lindenmaier, Goetz <goetz.lindenmaier at sap.com> wrote:
> 
> OK, so I went back and checked it all ...
> 1.) -Wconversion is set since ever:
>     http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/rev/3e82d72933d0
> 2.) The warning is not triggered by -Wconversion, it is enabled per default in gcc 4.1.2:

Does the warning still occur if -Wconversion is explicitly turn it
off, e.g. add -Wno-conversion?  Unfortunately, after reading these

http://lists.apple.com/archives/xcode-users/2005/Oct/msg00147.html
https://gcc.gnu.org/wiki/NewWconversion

I suspect it does, which would be unfortunate. But confirmation would
be helpful, and would strongly affect my opinion about how to proceed.

[Note that the NewWconversion page suggests we really ought not be
using the pre-gcc4.3 -Wconversion either.  But if -Wno-conversion
doesn't do anything useful for you then that's a separate issue.]

An important (to me) reason to not hide these warnings via unchecked
casts is that doing so makes it harder to properly address
JDK-8135181, because some of the places that ought to be modified as
part of that will be harder to find.

> And I would really appreciate if the following two issues could be kept separate:
> 
> - Decision what compiler is supported with which settings.
> - Fixes for a supported compiler/flag combination.

I don't think those are separable. If a particular configuration
rejects otherwise working code, then the configuration ought to be
looked at. Even if it's decided that the code must be changed rather
than the configuration, if the modified code is clearly a workaround
rather than a "natural" alternative, I think the workaround should be
made obvious and traceable to the problematic configuration.
Otherwise, future readers cannot tell whether the code is odd for a
good reason, and the workaround is hard to clean up in the future.

The fact that this particular problem has been cropping up repeatedly 
suggests to me that some concerted effort should be applied to the
problem.  I spent a little bit of time today prototyping an
integer_cast function, which would cover most of the cases mentioned
in JDK-8135181 and all in the changeset under discussion.  It doesn't
look too difficult, but I haven't finished or really tested it yet.



More information about the hotspot-gc-dev mailing list