This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
prologue line number fix
- To: gcc-patches at gcc dot gnu dot org
- Subject: prologue line number fix
- From: Richard Henderson <rth at redhat dot com>
- Date: Sat, 25 Nov 2000 16:21:53 -0800
Currently debug information for the prologue will point at the closing
brace of the function. Which among other reasons to be called incorrect
is that it is confusing.
I am way confused by the order of operations in the front end with
functions as trees. Why in the world we call init_function_start
from store_parm_decls when we have zero intention of emitting rtl
is quite beyond me. My only guess is that it is done to avoid hordes
of not-quite-correct code from segfaulting, which is what happens
if you remove that invocation.
By trial and error it appears that DECL_SOURCE_LINE for a function
definition is properly set to the open brace. Therefore, we can use
this instead of lineno to emit the proper information.
r~
* c-decl.c (c_expand_body): Use DECL_SOURCE_LINE rather than
lineno for the start of the function.
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-decl.c,v
retrieving revision 1.181
diff -c -p -d -r1.181 c-decl.c
*** c-decl.c 2000/11/25 19:28:41 1.181
--- c-decl.c 2000/11/25 23:06:55
*************** c_expand_body (fndecl, nested_p)
*** 6806,6812 ****
/* Initialize the RTL code for the function. */
current_function_decl = fndecl;
! init_function_start (fndecl, input_filename, lineno);
/* This function is being processed in whole-function mode. */
cfun->x_whole_function_mode_p = 1;
--- 6809,6815 ----
/* Initialize the RTL code for the function. */
current_function_decl = fndecl;
! init_function_start (fndecl, input_filename, DECL_SOURCE_LINE (fndecl));
/* This function is being processed in whole-function mode. */
cfun->x_whole_function_mode_p = 1;