aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/f-typeprint.c6
2 files changed, 8 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c9fdd66..a7be826 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2017-02-27 Yao Qi <yao.qi@linaro.org>
+
+ * f-typeprint.c (f_print_type): Check "varstring" is empty first.
+
2017-02-26 Alan Hayward <alan.hayward@arm.com>
* regcache.c (regcache_raw_update): New function.
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
index da6ef4f..7dbe093 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);
}
}