aboutsummaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-03-18 18:06:15 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2009-03-18 18:06:15 +0100
commitd130d647f6ea66c2773f822f8f834a57b00fb817 (patch)
treed085647e97b62f96314401a16b2427b7029080a5 /gcc/function.c
parent8f5929e11fa965fd2ad5d63c55de1cebc1b06af3 (diff)
downloadgcc-d130d647f6ea66c2773f822f8f834a57b00fb817.zip
gcc-d130d647f6ea66c2773f822f8f834a57b00fb817.tar.gz
gcc-d130d647f6ea66c2773f822f8f834a57b00fb817.tar.bz2
re PR debug/39485 (-O0 -g still puts whole object to a register)
PR debug/39485 * function.c (use_register_for_decl): When not optimizing, disregard register keyword for variables with types containing methods. From-SVN: r144939
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/gcc/function.c b/gcc/function.c
index 76d4834..e8d9901 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. */