re PR debug/70271 (internal compiler error: in dwarf2out_finish, at dwarf2out.c:27346)
authorRichard Biener <rguenther@suse.de>
Thu, 17 Mar 2016 13:43:01 +0000 (13:43 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 17 Mar 2016 13:43:01 +0000 (13:43 +0000)
2016-03-17  Richard Biener  <rguenther@suse.de>

PR debug/70271
* dwarf2out.c (dwarf2out_early_finish): Process deferred_asm_name
last.

* g++.dg/debug/pr70271.C: New testcase.

From-SVN: r234289

gcc/ChangeLog
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/pr70271.C [new file with mode: 0644]

index 3edfba0b110d2f7359796794124e6569b00eab38..a573275d97acbe096bcb3fb8f0b9889e00f0639b 100644 (file)
@@ -1,3 +1,9 @@
+2016-03-17  Richard Biener  <rguenther@suse.de>
+
+       PR debug/70271
+       * dwarf2out.c (dwarf2out_early_finish): Process deferred_asm_name
+       last.
+
 2016-03-17  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/70245
index 61bf267d6ec5350ae2bd049f5e5dd30c4133b71c..0bbff87a95ee1fc0881327557b7e08647f0f8619 100644 (file)
@@ -27686,10 +27686,15 @@ dwarf2out_finish (const char *filename)
 static void
 dwarf2out_early_finish (void)
 {
-  limbo_die_node *node;
+  /* The point here is to flush out the limbo list so that it is empty
+     and we don't need to stream it for LTO.  */
+  flush_limbo_die_list ();
+
+  gen_scheduled_generic_parms_dies ();
+  gen_remaining_tmpl_value_param_die_attribute ();
 
   /* Add DW_AT_linkage_name for all deferred DIEs.  */
-  for (node = deferred_asm_name; node; node = node->next)
+  for (limbo_die_node *node = deferred_asm_name; node; node = node->next)
     {
       tree decl = node->created_for;
       if (DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl)
@@ -27703,13 +27708,6 @@ dwarf2out_early_finish (void)
        }
     }
   deferred_asm_name = NULL;
-
-  /* The point here is to flush out the limbo list so that it is empty
-     and we don't need to stream it for LTO.  */
-  flush_limbo_die_list ();
-
-  gen_scheduled_generic_parms_dies ();
-  gen_remaining_tmpl_value_param_die_attribute ();
 }
 
 /* Reset all state within dwarf2out.c so that we can rerun the compiler
index d305b0f5900a3984e83d2308d324b97c3f2e9059..b0bdc245e67a31bd3bbce7586894c8526b96d9cc 100644 (file)
@@ -1,3 +1,8 @@
+2016-03-17  Richard Biener  <rguenther@suse.de>
+
+       PR debug/70271
+       * g++.dg/debug/pr70271.C: New testcase.
+
 2016-03-17  Ilya Enkovich  <enkovich.gnu@gmail.com>
 
        * gcc.target/i386/pr70251.c: New test.
diff --git a/gcc/testsuite/g++.dg/debug/pr70271.C b/gcc/testsuite/g++.dg/debug/pr70271.C
new file mode 100644 (file)
index 0000000..3c96d3a
--- /dev/null
@@ -0,0 +1,36 @@
+// { dg-do compile }
+
+template <typename Function>
+struct function_traits
+: public function_traits<decltype(&Function::operator())> 
+{ };
+
+template <typename ClassType, typename ReturnType, typename... Args>
+struct function_traits<ReturnType(ClassType::*)(Args...) const> 
+{
+  typedef ReturnType (*pointer)(Args...);
+  typedef ReturnType return_type;
+};
+
+template <typename Function>
+typename function_traits<Function>::pointer
+FunctionPointer (const Function& lambda) 
+{
+  return static_cast<typename function_traits<Function>::pointer>(lambda);
+}
+
+template <typename Function>
+typename function_traits<Function>::return_type
+GetReturnValue (Function func) 
+{
+  typename function_traits<Function>::return_type *dummy;
+  return *dummy;
+}
+template <typename T> class ClassFoo {};
+template <typename T> void FuncBar () { }
+
+template <> inline void FuncBar<double> ()
+{
+  typedef void (*func_type)(ClassFoo<double> &);
+  func_type f1 = FunctionPointer ([](ClassFoo<double> & ref) { });
+}