From c67f69a3f3977669094ed9a815116d2b97ac09d1 Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Fri, 23 Apr 2010 14:20:59 +0000 Subject: [PATCH] re PR lto/42653 (ICE with -g and -flto (requires both flags to crash)) 2010-04-23 Richard Guenther 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 | 6 ++++ gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/g++.dg/lto/20100423-1_0.C | 38 +++++++++++++++++++++++++ gcc/tree.c | 3 +- 4 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/lto/20100423-1_0.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bfbbc864a34..d81d2eb6b51 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-04-23 Richard Guenther + + PR lto/42653 + * tree.c (free_lang_data_in_decl): Do not reset DECL_CONTEXT + of FUNCTION_DECLs. + 2010-04-22 Laurynas Biveinis * sese.h (create_if_region_on_edge): Remove. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d057d15e267..5dfed408609 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-04-23 Richard Guenther + + PR lto/42653 + * g++.dg/lto/20100423-1_0.C: New testcase. + 2010-04-22 Uros Bizjak * 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 index 00000000000..f6a741dad8a --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20100423-1_0.C @@ -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) + { + } + }; +} + diff --git a/gcc/tree.c b/gcc/tree.c index 0eab137863b..561367bdd43 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -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) -- 2.30.2