From 1fec56cf14675d1fcd5281c3e8bdfa0350894259 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 30 Jan 2017 22:26:26 +0000 Subject: [PATCH] re PR debug/79289 (DWARF info for typeof of C function with no args and no prototype is empty pointer) PR debug/79289 * dwarf2out.c (gen_type_die_with_usage): When picking a variant for FUNCTION_TYPE/METHOD_TYPE, use the first matching one. From-SVN: r245039 --- gcc/ChangeLog | 6 ++++++ gcc/dwarf2out.c | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ca356c6cef9..21fb1419299 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-01-30 Ian Lance Taylor + + PR debug/79289 + * dwarf2out.c (gen_type_die_with_usage): When picking a variant + for FUNCTION_TYPE/METHOD_TYPE, use the first matching one. + 2017-01-30 Martin Sebor * doc/invoke.texi (-Wformat-truncation=1): Fix typo. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 1b2c04cc00a..0368f8d0d14 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -24453,8 +24453,13 @@ gen_type_die_with_usage (tree type, dw_die_ref context_die, but try to canonicalize. */ tree main = TYPE_MAIN_VARIANT (type); for (tree t = main; t; t = TYPE_NEXT_VARIANT (t)) - if (check_base_type (t, main) && check_lang_type (t, type)) - type = t; + { + if (check_base_type (t, main) && check_lang_type (t, type)) + { + type = t; + break; + } + } } else if (TREE_CODE (type) != VECTOR_TYPE && TREE_CODE (type) != ARRAY_TYPE)