aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2013-10-10 21:32:22 +0200
committerTobias Burnus <burnus@gcc.gnu.org>2013-10-10 21:32:22 +0200
commit58b2a3585302ca85e06c5957e307f292c61036d9 (patch)
tree233938d2d4b1d2f382d5d719495bb4278e21dd78
parentb591a8b78c5e66da7a4536f823d31b56005be77f (diff)
downloadgcc-58b2a3585302ca85e06c5957e307f292c61036d9.zip
gcc-58b2a3585302ca85e06c5957e307f292c61036d9.tar.gz
gcc-58b2a3585302ca85e06c5957e307f292c61036d9.tar.bz2
re PR fortran/58226 (negative subscript pos at fortran/options.c:1205)
2013-10-09 Tobias Burnus <burnus@net-b.de> PR fortran/58226 * options.c (gfc_get_option_string): Handle zero arg case. From-SVN: r203394
-rw-r--r--gcc/fortran/ChangeLog5
-rw-r--r--gcc/fortran/options.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 4463ecd..2a3be8d 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,8 @@
+2013-10-10 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/58226
+ * options.c (gfc_get_option_string): Handle zero arg case.
+
2013-10-02 Tobias Burnus <burnus@net-b.de>
PR fortran/58593
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index 3a9c508..6e4e7c1 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -1166,6 +1166,10 @@ gfc_get_option_string (void)
size_t len, pos;
char *result;
+ /* Allocate and return a one-character string with '\0'. */
+ if (!save_decoded_options_count)
+ return XCNEWVEC (char, 1);
+
/* Determine required string length. */
len = 0;