re PR lto/42653 (ICE with -g and -flto (requires both flags to crash))
authorRichard Guenther <rguenther@suse.de>
Fri, 23 Apr 2010 14:20:59 +0000 (14:20 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 23 Apr 2010 14:20:59 +0000 (14:20 +0000)
2010-04-23  Richard Guenther  <rguenther@suse.de>

PR lto/42653
* tree.c (free_lang_data_in_decl): Do not reset DECL_CONTEXT
of FUNCTION_DECLs.

* g++.dg/lto/20100423-1_0.C: New testcase.

From-SVN: r158666

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lto/20100423-1_0.C [new file with mode: 0644]
gcc/tree.c

index bfbbc86..d81d2eb 100644 (file)
@@ -1,3 +1,9 @@
+2010-04-23  Richard Guenther  <rguenther@suse.de>
+
+       PR lto/42653
+       * tree.c (free_lang_data_in_decl): Do not reset DECL_CONTEXT
+       of FUNCTION_DECLs.
+
 2010-04-22  Laurynas Biveinis  <laurynas.biveinis@gmail.com>
 
        * sese.h (create_if_region_on_edge): Remove.
index d057d15..5dfed40 100644 (file)
@@ -1,3 +1,8 @@
+2010-04-23  Richard Guenther  <rguenther@suse.de>
+
+       PR lto/42653
+       * g++.dg/lto/20100423-1_0.C: New testcase.
+
 2010-04-22  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.dg/graphite/interchange-0.c: Fix dg-final directive.
diff --git a/gcc/testsuite/g++.dg/lto/20100423-1_0.C b/gcc/testsuite/g++.dg/lto/20100423-1_0.C
new file mode 100644 (file)
index 0000000..f6a741d
--- /dev/null
@@ -0,0 +1,38 @@
+// { dg-lto-do assemble }
+// { dg-lto-options {{-g -flto}} }
+
+namespace llvm
+{
+  class Function;
+  class MachineCodeInfo;
+  class ExecutionEngine
+    {
+    };
+  class JIT : public ExecutionEngine
+  {
+    void runJITOnFunction (Function * F, MachineCodeInfo * MCI = 0);
+  };
+  class JITEventListener
+    {
+    public:
+      JITEventListener ()
+       {
+       }
+      virtual ~JITEventListener ();
+    };
+}
+
+using namespace llvm;
+void
+JIT::runJITOnFunction (Function * F, MachineCodeInfo * MCI)
+{
+  class MCIListener:public JITEventListener
+  {
+    MachineCodeInfo *const MCI;
+  public: 
+    MCIListener (MachineCodeInfo * mci):MCI (mci)
+        {
+        }
+  };
+}
+
index 0eab137..561367b 100644 (file)
@@ -4361,7 +4361,8 @@ free_lang_data_in_decl (tree decl)
 
   /* Ignore any intervening types, because we are going to clear their
      TYPE_CONTEXT fields.  */
-  if (TREE_CODE (decl) != FIELD_DECL)
+  if (TREE_CODE (decl) != FIELD_DECL
+      && TREE_CODE (decl) != FUNCTION_DECL)
     DECL_CONTEXT (decl) = decl_function_context (decl);
 
   if (DECL_CONTEXT (decl)