RFR [XS] : hotspot/share/opto/parse2.cpp compile error with gcc 7.3.1

Vladimir Kozlov vladimir.kozlov at oracle.com
Tue Oct 9 15:06:17 UTC 2018


Looks good.

Why there is no complain about sprintf at line 2857 which uses %s? :
http://hg.openjdk.java.net/jdk/jdk/file/d24b89390f6c/src/hotspot/share/opto/parse2.cpp#l2857

Thanks,
Vladimir

On 10/9/18 6:51 AM, Baesken, Matthias wrote:
> Hello, please review this gcc 7 related build fix .
> 
> 
> When  building on Linux with gcc 7.3.1  I run into this  compile error :
> 
> /open_jdk/jdk_just_clone/jdk/src/hotspot/share/opto/parse2.cpp:1349:14: note: 'sprintf' output 2 or more bytes (assuming 2147488583) into a destination of size 30
>         sprintf(prob_str_buf, "%g", prob);
>         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1plus: all warnings being treated as errors
> 
> 
> The issue is that  we print a floating point number into a fixed size buffer for output .
> 
> I adjusted the coding a bit :
> 
> http://cr.openjdk.java.net/~mbaesken/webrevs/8211929.0/
> 
> https://bugs.openjdk.java.net/browse/JDK-8211929
> 
> 
> 
> Best regards, Matthias
> 


More information about the hotspot-dev mailing list