RFR(XXS): 8135179: Fix conversion warning after 8067341
Lindenmaier, Goetz
goetz.lindenmaier at sap.com
Thu Sep 10 06:51:59 UTC 2015
Hi Volker,
thanks for this fix! It's good.
Could somebody please sponsor this one-liner? Thanks!
Best regards,
Goetz.
-----Original Message-----
From: hotspot-dev [mailto:hotspot-dev-bounces at openjdk.java.net] On Behalf Of Volker Simonis
Sent: Dienstag, 8. September 2015 18:57
To: HotSpot Open Source Developers
Subject: RFR(XXS): 8135179: Fix conversion warning after 8067341
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);
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?
More information about the hotspot-dev
mailing list