Message ID | 5255CFE2.3050507@net-b.de |
---|---|
State | New |
Headers | show |
On Wed, Oct 09, 2013 at 11:51:30PM +0200, Tobias Burnus wrote: > A rather obvious fix; the memory is freed by the caller > (gfc_simplify_compiler_options). It is unlikely that the compiler has no > arguments as the driver tends to send some, e.g. "-mtune=generic > -march=x86-64" on my system. However, it is better to be safe than sorry. > > Build and regtested on x86-64-gnu-linux. > OK? > Ok.
2013-10-09 Tobias Burnus <burnus@net-b.de> PR fortran/58226 * options.c (gfc_get_option_string): Handle zero arg case. 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;