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

Lindenmaier, Goetz goetz.lindenmaier at sap.com
Thu Nov 19 09:44:07 UTC 2015

Hi Kim

OK, so I went back and checked it all ...
1.) -Wconversion is set since ever:
2.) The warning is not triggered by -Wconversion, it is enabled per default in gcc 4.1.2:
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 -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'

3.) The warning would also be issued in our internal product build, where I would have to fix it.

So I think this should be fixed as I propose.

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.

The fixes I have to do here are a pure nuisance but necessary as the build breaks.
If we always have to run the full discussion about flags, compilers, etc on these
changes this is unnecessary overhead.  We had the same discussion with 
changes for Visual Studio 2010 just a few weeks ago.


> -----Original Message-----
> From: Kim Barrett [mailto:kim.barrett at oracle.com]
> Sent: Donnerstag, 19. November 2015 00:04
> To: Lindenmaier, Goetz
> 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 18, 2015, at 3:31 PM, Lindenmaier, Goetz
> <goetz.lindenmaier at sap.com> wrote:
> >
> > Yes, this is because the warnings are enabled, and -Werror is set.
> > I had to do similar changes on a regular basis before, and I don't want to
> > question support of gcc 4.1.2 and the corresponding flags each time.
> OK, that helps.  But is it specifically -Wconversion, or is there some
> other warning involved?
> Assuming it is -Wconversion that is causing this and similar issues, I
> suggest the real (and ongoing) problem is the use of that flag.
> The meaning of that flag was changed in gcc4.3 to something that the
> hotspot code base is *really* not prepared for.
> Before gcc4.3 it was a mechanism for detecting differences that would
> arise between code that had prototypes and code that didn't.  Well,
> that's just not an issue.  So I suggest there is no benefit to
> enabling this warning.  And if it is leading to build failures with
> old versions of gcc, then I suggest that enabling it is actively
> harmful.

More information about the hotspot-gc-dev mailing list