summaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2009-01-03 00:52:51 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2009-01-03 00:52:51 +0000
commit062b4460bb67c5a1855046ebef464b38f8c8c132 (patch)
tree86cded00cdc605437b4b88313a78ce8f36fa1dbd /gcc/builtins.c
parent7e009ff528f39d010bb8d274713dc653dcf7f684 (diff)
downloadgcc-062b4460bb67c5a1855046ebef464b38f8c8c132.tar.gz
PR c/38700
* builtins.c (fold_builtin_expect): Only check DECL_WEAK for VAR_DECLs and FUNCTION_DECLs. * gcc.dg/pr38700.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@143028 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 607d7dd36b1..cda94c3cbc0 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -1,6 +1,6 @@
/* Expand builtin functions.
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
This file is part of GCC.
@@ -7324,7 +7324,9 @@ fold_builtin_expect (tree arg0, tree arg1)
}
while (TREE_CODE (inner) == COMPONENT_REF
|| TREE_CODE (inner) == ARRAY_REF);
- if (DECL_P (inner) && DECL_WEAK (inner))
+ if ((TREE_CODE (inner) == VAR_DECL
+ || TREE_CODE (inner) == FUNCTION_DECL)
+ && DECL_WEAK (inner))
return NULL_TREE;
}