aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2006-05-08 23:42:17 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2006-05-08 21:42:17 +0000
commit04f77d0f3b194ada4e89a3bf8df3b55bf370fbfa (patch)
tree20192039e8e9228577157ac0f0ac0de5b704563c /gcc/cgraphunit.c
parent857e57535196dbb690cf80afadbfda9756417a4b (diff)
downloadgcc-04f77d0f3b194ada4e89a3bf8df3b55bf370fbfa.zip
gcc-04f77d0f3b194ada4e89a3bf8df3b55bf370fbfa.tar.gz
gcc-04f77d0f3b194ada4e89a3bf8df3b55bf370fbfa.tar.bz2
re PR middle-end/25962 (Pointer (null) check after the use in cgraph.c)
PR middle-end/25962 * cgraphunit.c (decide_is_function_needed): When not optimizing even unused static functions are needed. * gcc.dg/pr25962.c: New. From-SVN: r113633
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 4a7f90e..351f5f0 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -216,8 +216,12 @@ decide_is_function_needed (struct cgraph_node *node, tree decl)
return true;
/* Externally visible functions must be output. The exception is
- COMDAT functions that must be output only when they are needed. */
- if ((TREE_PUBLIC (decl) && !flag_whole_program)
+ COMDAT functions that must be output only when they are needed.
+
+ When not optimizing, also output the static functions. (see
+ PR25962)
+ */
+ if (((TREE_PUBLIC (decl) || !optimize) && !flag_whole_program)
&& !DECL_COMDAT (decl) && !DECL_EXTERNAL (decl))
return true;