8211929: hotspot/share/opto/parse2.cpp compile error with gcc 7.3.1
authormbaesken
Wed, 10 Oct 2018 16:56:18 +0200
changeset 52090 b698138cf69b
parent 52089 081aed66b645
child 52091 b25bfa10f52f
8211929: hotspot/share/opto/parse2.cpp compile error with gcc 7.3.1 Reviewed-by: kvn, stuefe
src/hotspot/share/opto/parse2.cpp
--- a/src/hotspot/share/opto/parse2.cpp	Wed Oct 10 23:47:36 2018 -0400
+++ b/src/hotspot/share/opto/parse2.cpp	Wed Oct 10 16:56:18 2018 +0200
@@ -1346,7 +1346,7 @@
     if (prob <= PROB_MIN)  prob_str = (prob == PROB_MIN) ? "min" : "never";
     char prob_str_buf[30];
     if (prob_str == NULL) {
-      sprintf(prob_str_buf, "%g", prob);
+      jio_snprintf(prob_str_buf, sizeof(prob_str_buf), "%20.2f", prob);
       prob_str = prob_str_buf;
     }
     C->log()->elem("branch target_bci='%d' taken='%d' not_taken='%d' cnt='%f' prob='%s'",
@@ -2854,7 +2854,7 @@
   IdealGraphPrinter *printer = C->printer();
   if (printer && printer->should_print(1)) {
     char buffer[256];
-    sprintf(buffer, "Bytecode %d: %s", bci(), Bytecodes::name(bc()));
+    jio_snprintf(buffer, sizeof(buffer), "Bytecode %d: %s", bci(), Bytecodes::name(bc()));
     bool old = printer->traverse_outs();
     printer->set_traverse_outs(true);
     printer->print_method(buffer, 4);