aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2010-05-31 11:43:31 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2010-05-31 11:43:31 +0000
commitc5d01958a7b919d0407e8982d70e52fafa8588d2 (patch)
tree8cfca062d11d0ba0c64fbcf7479cc62376f5cff5 /gcc
parenta4c9bc1594bef333dc17be8d37625356e8b8c476 (diff)
downloadgcc-c5d01958a7b919d0407e8982d70e52fafa8588d2.zip
gcc-c5d01958a7b919d0407e8982d70e52fafa8588d2.tar.gz
gcc-c5d01958a7b919d0407e8982d70e52fafa8588d2.tar.bz2
cgraphunit.c (cgraph_decide_is_function_needed): Really return false for nested functions in non-optimized compilation.
* cgraphunit.c (cgraph_decide_is_function_needed): Really return false for nested functions in non-optimized compilation. From-SVN: r160068
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/cgraphunit.c8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/nested-func-7.c15
-rw-r--r--gcc/testsuite/gnat.dg/frame_overflow.adb5
5 files changed, 33 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 48206e5..c1b62ce 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2010-05-31 Eric Botcazou <ebotcazou@adacore.com>
+
+ * cgraphunit.c (cgraph_decide_is_function_needed): Really return false
+ for nested functions in non-optimized compilation.
+
2010-05-31 Richard Guenther <rguenther@suse.de>
* tree-ssa-structalias.c (find_func_aliases): Handle
@@ -35,7 +40,7 @@
2010-05-30 Jan Hubicka <jh@suse.cz>
* toplev.c (wrapup_global_declaration_2): Avoid creation of new varpool
- nodes
+ nodes.
2010-05-30 Richard Guenther <rguenther@suse.de>
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 3dfbc92..1d5ed0d 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -352,13 +352,15 @@ cgraph_decide_is_function_needed (struct cgraph_node *node, tree decl)
When not optimizing, also output the static functions. (see
PR24561), but don't do so for always_inline functions, functions
- declared inline and nested functions. These was optimized out
+ declared inline and nested functions. These were optimized out
in the original implementation and it is unclear whether we want
to change the behavior here. */
if (((TREE_PUBLIC (decl)
- || (!optimize && !node->local.disregard_inline_limits
+ || (!optimize
+ && !node->local.disregard_inline_limits
&& !DECL_DECLARED_INLINE_P (decl)
- && !node->origin))
+ && !(DECL_CONTEXT (decl)
+ && TREE_CODE (DECL_CONTEXT (decl)) == FUNCTION_DECL)))
&& !flag_whole_program
&& !flag_lto
&& !flag_whopr)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 43f4478..69808cd 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-05-31 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gcc.dg/nested-func-7.c: New test.
+ * gnat.dg/frame_overflow.adb: Adjust directives.
+
2010-05-30 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/prot2.ad[sb]: New test.
diff --git a/gcc/testsuite/gcc.dg/nested-func-7.c b/gcc/testsuite/gcc.dg/nested-func-7.c
new file mode 100644
index 0000000..764beb4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/nested-func-7.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-optimized" } */
+
+void foo (void)
+{
+ int a;
+
+ void bar (void)
+ {
+ a = 1;
+ }
+}
+
+/* { dg-final { scan-tree-dump-not "bar" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */
diff --git a/gcc/testsuite/gnat.dg/frame_overflow.adb b/gcc/testsuite/gnat.dg/frame_overflow.adb
index 055fa28..e1ff4d3 100644
--- a/gcc/testsuite/gnat.dg/frame_overflow.adb
+++ b/gcc/testsuite/gnat.dg/frame_overflow.adb
@@ -1,5 +1,4 @@
-- { dg-do compile }
--- { dg-xfail-if "missing late warning" { *-*-* } { "-flto" } { "" } }
with System;
@@ -11,8 +10,8 @@ procedure frame_overflow is
type Bitmap_T is record
Bits : Bitmap_Array_T := (others => False);
end record;
-
- function -- { dg-error "too large" }
+
+ function
Set_In (Bitmap : Bitmap_T; Bitpos : Bitpos_Range_T) return Bitmap_T
is
Result: Bitmap_T := Bitmap; -- { dg-error "Storage_Error" }