diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c9fdd66f27f..a7be8266ea9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2017-02-27 Yao Qi + + * f-typeprint.c (f_print_type): Check "varstring" is empty first. + 2017-02-26 Alan Hayward * regcache.c (regcache_raw_update): New function. diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c index da6ef4f92e5..7dbe093a7fc 100644 --- a/gdb/f-typeprint.c +++ b/gdb/f-typeprint.c @@ -52,7 +52,6 @@ f_print_type (struct type *type, const char *varstring, struct ui_file *stream, int show, int level, const struct type_print_options *flags) { enum type_code code; - int demangled_args; if (type_not_associated (type)) { @@ -81,12 +80,15 @@ f_print_type (struct type *type, const char *varstring, struct ui_file *stream, if (varstring != NULL) { + int demangled_args; + fputs_filtered (varstring, stream); /* For demangled function names, we have the arglist as part of the name, so don't print an additional pair of ()'s. */ - demangled_args = varstring[strlen (varstring) - 1] == ')'; + demangled_args = (*varstring != '\0' + && varstring[strlen (varstring) - 1] == ')'); f_type_print_varspec_suffix (type, stream, show, 0, demangled_args, 0); } }