[libgfortran] PR86070 - [7 regression] gfortran.dg/fmt_zero_digits.f90 segmentation fault

Message ID f0a62620-8671-aeb4-8bec-7f5465c9f22b@charter.net
State New
Headers show
Series
  • [libgfortran] PR86070 - [7 regression] gfortran.dg/fmt_zero_digits.f90 segmentation fault
Related show

Commit Message

Jerry DeLisle June 10, 2018, 1:48 a.m.
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  <jvdelisle@gcc.gnu.org>

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

Patch

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;