From: Tobias Burnus Date: Thu, 10 Oct 2013 19:32:22 +0000 (+0200) Subject: re PR fortran/58226 (negative subscript pos at fortran/options.c:1205) X-Git-Tag: releases/gcc-4.9.0~3608 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58b2a3585302ca85e06c5957e307f292c61036d9;p=thirdparty%2Fgcc.git re PR fortran/58226 (negative subscript pos at fortran/options.c:1205) 2013-10-09 Tobias Burnus PR fortran/58226 * options.c (gfc_get_option_string): Handle zero arg case. From-SVN: r203394 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 4463ecd84dce..2a3be8d64f29 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2013-10-10 Tobias Burnus + + PR fortran/58226 + * options.c (gfc_get_option_string): Handle zero arg case. + 2013-10-02 Tobias Burnus PR fortran/58593 diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index 3a9c508dc27e..6e4e7c116967 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;