summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-07 15:28:50 +0000
committerfroydnj <froydnj@138bc75d-0d04-0410-961f-82ee72b054a4>2011-03-07 15:28:50 +0000
commit6b37ba94eaf5500791126dbc3ce356f35360fa7b (patch)
tree32cef28280f3982cb6aecec7b662e9e936b65df2
parent7a2d6ba2048b0709e5bf9a69ea86af8a25fbb45e (diff)
downloadgcc-6b37ba94eaf5500791126dbc3ce356f35360fa7b.tar.gz
gcc/
* gimplify.c (gimplify_function_tree): Fix building calls to __builtin_return_address. gcc/testsuite/ * gcc.dg/20001117-1.c: Abort on NULL call_sites. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@170738 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/gimplify.c4
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/20001117-1.c18
4 files changed, 28 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0918f7a60fa..5b7a188e11f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-07 Paul Wögerer <paul_woegerer@mentor.com>
+
+ * gimplify.c (gimplify_function_tree): Fix building calls
+ to __builtin_return_address.
+
2011-03-07 Alan Modra <amodra@gmail.com>
* config/rs6000/linux.h (TARGET_ASM_FILE_END): Don't define.
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index cf9495c9198..400493fa4fe 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -7868,7 +7868,7 @@ gimplify_function_tree (tree fndecl)
gimple call;
x = implicit_built_in_decls[BUILT_IN_RETURN_ADDRESS];
- call = gimple_build_call (x, 0);
+ call = gimple_build_call (x, 1, integer_zero_node);
tmp_var = create_tmp_var (ptr_type_node, "return_addr");
gimple_call_set_lhs (call, tmp_var);
gimplify_seq_add_stmt (&cleanup, call);
@@ -7880,7 +7880,7 @@ gimplify_function_tree (tree fndecl)
tf = gimple_build_try (seq, cleanup, GIMPLE_TRY_FINALLY);
x = implicit_built_in_decls[BUILT_IN_RETURN_ADDRESS];
- call = gimple_build_call (x, 0);
+ call = gimple_build_call (x, 1, integer_zero_node);
tmp_var = create_tmp_var (ptr_type_node, "return_addr");
gimple_call_set_lhs (call, tmp_var);
gimplify_seq_add_stmt (&body, call);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8e5f44c204b..9642dfec795 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-03-07 Paul Wögerer <paul_woegerer@mentor.com>
+ Nathan Froyd <froydnj@codesourcery.com>
+
+ * gcc.dg/20001117-1.c: Abort on NULL call_sites.
+
2011-03-06 Mark Mitchell <mark@codesourcery.com>
* README.QMTEST: Remove.
diff --git a/gcc/testsuite/gcc.dg/20001117-1.c b/gcc/testsuite/gcc.dg/20001117-1.c
index baf06919317..a9de496e276 100644
--- a/gcc/testsuite/gcc.dg/20001117-1.c
+++ b/gcc/testsuite/gcc.dg/20001117-1.c
@@ -24,5 +24,19 @@ int main ()
exit (0);
}
-void __attribute__((no_instrument_function)) __cyg_profile_func_enter(void *this_fn, void *call_site) { }
-void __attribute__((no_instrument_function)) __cyg_profile_func_exit(void *this_fn, void *call_site) { }
+/* Abort on non-NULL CALL_SITE to ensure that __builtin_return_address
+ was expanded properly. */
+void __attribute__((no_instrument_function))
+__cyg_profile_func_enter(void *this_fn, void *call_site)
+{
+ if (call_site == (void *)0)
+ abort ();
+}
+
+void __attribute__((no_instrument_function))
+__cyg_profile_func_exit(void *this_fn, void *call_site)
+{
+ if (call_site == (void *)0)
+ abort ();
+}
+