RFR(XXS): 8135179: Fix conversion warning after 8067341 (original) (raw)
Thomas Schatzl thomas.schatzl at oracle.com
Thu Sep 10 09:17:49 UTC 2015
- Previous message: RFR(XXS): 8135179: Fix conversion warning after 8067341
- Next message: RFR(XXS): 8135179: Fix conversion warning after 8067341
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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: sizet const curplabsz = (double)totalwasteallowed / 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::adjustdesiredplabsz()': hotspot-rt/src/share/vm/gc/g1/g1EvacStats.cpp:96: warning: converting to 'sizet' from 'double' make[4]: *** [g1EvacStats.o] Error 1 The warning can be easily fixed as follows: sizet const curplabsz = (siztet)((double)totalwasteallowed / 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
- Previous message: RFR(XXS): 8135179: Fix conversion warning after 8067341
- Next message: RFR(XXS): 8135179: Fix conversion warning after 8067341
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]