gimplify.c (gimplify_function_tree): Fix building calls to __builtin_return_address.
authorPaul Wögerer <paul_woegerer@mentor.com>
Mon, 7 Mar 2011 15:28:50 +0000 (15:28 +0000)
committerNathan Froyd <froydnj@gcc.gnu.org>
Mon, 7 Mar 2011 15:28:50 +0000 (15:28 +0000)
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.

Co-Authored-By: Nathan Froyd <froydnj@codesourcery.com>
From-SVN: r170738

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/20001117-1.c

index 0918f7a60fa8fac92c8b8dfd8b86dd42031f0c1d..5b7a188e11f8c57d58f9a8b7cc6173c05b228895 100644 (file)
@@ -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.
index cf9495c919895683c6f69b6806debc7d67fd6100..400493fa4fe68d5348ef18d1c430061e27c2d74a 100644 (file)
@@ -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);
index 8e5f44c204b77df03b6ac48f7a4c7ac6c8439df2..9642dfec7958700bf2ed233a89f81ad7e9868325 100644 (file)
@@ -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.
index baf0691931770fe68314b96d6406a7eeeaf7a117..a9de496e276571df54cc1c875148475886f12b25 100644 (file)
@@ -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 ();
+}
+