aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-live.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-06-05 17:35:13 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2009-06-05 17:35:13 +0200
commit9f706f23d133a3e4eb5130996461e5cfb2cb706a (patch)
tree12a9da39bc6bfc83111af358d8b58d60dbbd2f22 /gcc/tree-ssa-live.c
parent8f439681a9e2e7fa095868097d0e0cc331734957 (diff)
downloadgcc-9f706f23d133a3e4eb5130996461e5cfb2cb706a.zip
gcc-9f706f23d133a3e4eb5130996461e5cfb2cb706a.tar.gz
gcc-9f706f23d133a3e4eb5130996461e5cfb2cb706a.tar.bz2
re PR middle-end/40340 (Fortification warning no longer emitted in inlines)
PR middle-end/40340 * tree-ssa-live.c (remove_unused_scope_block_p): Don't prune inlined_function_outer_scope_p blocks for artificial inlines even at -g0/-g1. * tree.c (tree_nonartificial_location): Rewrite using block_nonartificial_location. * gcc.dg/pr40340-1.c: New test. * gcc.dg/pr40340-2.c: New test. * gcc.dg/pr40340-3.c: New test. * gcc.dg/pr40340-4.c: New test. * gcc.dg/pr40340-5.c: New test. * gcc.dg/pr40340.h: New file. From-SVN: r148212
Diffstat (limited to 'gcc/tree-ssa-live.c')
-rw-r--r--gcc/tree-ssa-live.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c
index c7366ff..a710c65 100644
--- a/gcc/tree-ssa-live.c
+++ b/gcc/tree-ssa-live.c
@@ -536,7 +536,25 @@ remove_unused_scope_block_p (tree scope)
/* For terse debug info we can eliminate info on unused variables. */
else if (debug_info_level == DINFO_LEVEL_NONE
|| debug_info_level == DINFO_LEVEL_TERSE)
- ;
+ {
+ /* Even for -g0/-g1 don't prune outer scopes from artificial
+ functions, otherwise diagnostics using tree_nonartificial_location
+ will not be emitted properly. */
+ if (inlined_function_outer_scope_p (scope))
+ {
+ tree ao = scope;
+
+ while (ao
+ && TREE_CODE (ao) == BLOCK
+ && BLOCK_ABSTRACT_ORIGIN (ao) != ao)
+ ao = BLOCK_ABSTRACT_ORIGIN (ao);
+ if (ao
+ && TREE_CODE (ao) == FUNCTION_DECL
+ && DECL_DECLARED_INLINE_P (ao)
+ && lookup_attribute ("artificial", DECL_ATTRIBUTES (ao)))
+ unused = false;
+ }
+ }
else if (BLOCK_VARS (scope) || BLOCK_NUM_NONLOCALIZED_VARS (scope))
unused = false;
/* See if this block is important for representation of inlined function.