From d5638e6e67baa1bff33c9808c8a12ed7ca11042a Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Wed, 16 May 2007 00:37:55 +0000 Subject: [PATCH] re PR fortran/31922 ([4.2 only] Accessing uninitialized variable for print *, trim(blank_string)) 2007-05-15 Jerry DeLisle PR libfortran/31922 * intrinsics/string_intrinsics.c (string_trim): Set result to null if string length is zero. From-SVN: r124754 --- libgfortran/ChangeLog | 6 ++++++ libgfortran/intrinsics/string_intrinsics.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index dec751f9c85..531787f3289 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2007-05-15 Jerry DeLisle + + PR libfortran/31922 + * intrinsics/string_intrinsics.c (string_trim): Set result to null if + string length is zero. + 2007-05-15 Tobias Burnus PR libfortran/31915 diff --git a/libgfortran/intrinsics/string_intrinsics.c b/libgfortran/intrinsics/string_intrinsics.c index 1a4b1593270..7c22c16abfe 100644 --- a/libgfortran/intrinsics/string_intrinsics.c +++ b/libgfortran/intrinsics/string_intrinsics.c @@ -171,6 +171,8 @@ string_trim (GFC_INTEGER_4 * len, void ** dest, GFC_INTEGER_4 slen, /* copy string if necessary. */ memmove (*dest, src, *len); } + else + *dest = NULL; }