From f24ccada1c36c73aba9ace75bf69487bef4216bf Mon Sep 17 00:00:00 2001 From: jakub Date: Wed, 18 Mar 2009 17:06:15 +0000 Subject: [PATCH] PR debug/39485 * function.c (use_register_for_decl): When not optimizing, disregard register keyword for variables with types containing methods. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@144939 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 4 ++++ gcc/function.c | 23 ++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c192bd61a48..a13d05e7588 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -12,6 +12,10 @@ * function.c (struct temp_slot): Likewise. * cfgloop.h (struct loop): Likewise. + PR debug/39485 + * function.c (use_register_for_decl): When not optimizing, disregard + register keyword for variables with types containing methods. + 2009-03-18 Sebastian Pop PR middle-end/39447 diff --git a/gcc/function.c b/gcc/function.c index 76d48347d48..e8d99015e4d 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -1942,7 +1942,28 @@ use_register_for_decl (const_tree decl) if (DECL_IGNORED_P (decl)) return true; - return (optimize || DECL_REGISTER (decl)); + if (optimize) + return true; + + if (!DECL_REGISTER (decl)) + return false; + + switch (TREE_CODE (TREE_TYPE (decl))) + { + case RECORD_TYPE: + case UNION_TYPE: + case QUAL_UNION_TYPE: + /* When not optimizing, disregard register keyword for variables with + types containing methods, otherwise the methods won't be callable + from the debugger. */ + if (TYPE_METHODS (TREE_TYPE (decl))) + return false; + break; + default: + break; + } + + return true; } /* Return true if TYPE should be passed by invisible reference. */ -- 2.11.0