RFR(XXS): 8135179: Fix conversion warning after 8067341
Thomas Schatzl
thomas.schatzl at oracle.com
Thu Sep 10 09:17:49 UTC 2015
Hi,
On Tue, 2015-09-08 at 18:56 +0200, Volker Simonis wrote:
> Hi,
>
> can somebody please review and sponsor the following trivial fix:
>
> http://cr.openjdk.java.net/~simonis/webrevs/2015/8135179/
> https://bugs.openjdk.java.net/browse/JDK-8135179
>
> Change "8067341: Modify PLAB sizing algorithm to waste less"
> introduced the following code:
>
> size_t const cur_plab_sz = (double)total_waste_allowed /
> G1LastPLABAverageOccupancy;
>
> which triggers a conversion warning with older versions of GCC and
> potentially other compilers as well:
>
> hotspot-rt/src/share/vm/gc/g1/g1EvacStats.cpp: In member function
> 'virtual void G1EvacStats::adjust_desired_plab_sz()':
> hotspot-rt/src/share/vm/gc/g1/g1EvacStats.cpp:96: warning: converting
> to 'size_t' from 'double'
> make[4]: *** [g1EvacStats.o] Error 1
>
> The warning can be easily fixed as follows:
>
> size_t const cur_plab_sz = (sizte_t)((double)total_waste_allowed /
> G1LastPLABAverageOccupancy);
looks good. Thanks for the fix. I can push the change.
> Thank you and best regards,
> Volker
>
>
> PS: as a side note I want to mention that we are currently disabling
> '-Wconversion' for GCC 4.3 and later because it produces too many
> warnings which are by default treated as errors. All the warnings
> produced by '-Wconversion' are about narrowing conversions which may
> result in a potential data loss.
>
> It may be a good idea to fix all these implicit narrowing conversions
> and re-enable -Wconversion warning by default.
>
> But unfortunately there's quite some code which has to be changed in
> order to meet the requirements of '-Wconversion'. A quick research
> showed that there are currently 137 different implicit narrowing
> conversions spread over 1785 different code locations.
>
> For more details see "8135181: Re-enable '-Wconversion' for GCC 4.3
> and later" (https://bugs.openjdk.java.net/browse/JDK-8135181) which
> I've opened to track the issue.
>
> What's the general opinion? Would it be worth wile to fix all these
> conversion warnings by inserting implicit casts?
I would think so that the goal is to gradually enable more warnings. I
guess it has been turned off because nobody stepped up fixing these
issues. :)
Thanks,
Thomas
More information about the hotspot-dev
mailing list