I have not confirmed this fixes the segfault reported, but valgrind reports jump or move on uninitialized for the test case and this fixes that part.

I will commit as obvious/simple on trunk and follow through on 7 and 8.

Regression tested on x86_64.

Regards,

Jerry

2018-06-09  Jerry DeLisle  <jvdeli...@gcc.gnu.org>

        PR libgfortran/86070
        * io/write_float.def (build_float_string): Initialize *len.

diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def
index 177a568e041..25ea64beb21 100644
--- a/libgfortran/io/write_float.def
+++ b/libgfortran/io/write_float.def
@@ -135,6 +135,7 @@ build_float_string (st_parameter_dt *dtp, const fnode *f, char *buffer,
   w = f->u.real.w;
   d = f->u.real.d;
   p = dtp->u.p.scale_factor;
+  *len = 0;

Reply via email to