aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2011-02-15 19:38:51 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2011-02-15 19:38:51 +0000
commited17fc411c33e37cdbb3d45fc3dc94908d536ae9 (patch)
treecd992af5ddd19429658340171a1acb8c6ef1caa4
parent72f812a2b53cc8b57c10534784022fea020be891 (diff)
downloadgcc-ed17fc411c33e37cdbb3d45fc3dc94908d536ae9.zip
gcc-ed17fc411c33e37cdbb3d45fc3dc94908d536ae9.tar.gz
gcc-ed17fc411c33e37cdbb3d45fc3dc94908d536ae9.tar.bz2
re PR fortran/47633 (Result of COMPILER_VERSION() has NULL byte appended)
2011-02-15 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/47633 . simplify.c (gfc_simplify_compiler_version): Fix off-by-one issue. From-SVN: r170195
-rw-r--r--gcc/fortran/ChangeLog5
-rw-r--r--gcc/fortran/simplify.c6
2 files changed, 8 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 8b4f63f..346bb9e 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,8 @@
+2011-02-15 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/47633
+ . simplify.c (gfc_simplify_compiler_version): Fix off-by-one issue.
+
2011-02-14 Janus Weil <janus@gcc.gnu.org>
PR fortran/47730
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index ba88044..bb8b575 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -6844,9 +6844,9 @@ gfc_simplify_compiler_version (void)
char *buffer;
size_t len;
- len = strlen ("GCC version ") + strlen (version_string) + 1;
- buffer = (char*) alloca (len);
- snprintf (buffer, len, "GCC version %s", version_string);
+ len = strlen ("GCC version ") + strlen (version_string);
+ buffer = XALLOCAVEC (char, len + 1);
+ snprintf (buffer, len + 1, "GCC version %s", version_string);
return gfc_get_character_expr (gfc_default_character_kind,
&gfc_current_locus, buffer, len);
}