This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix debug-line info for empty functions


Hello,

four gdb test cases fail on s390(x) because the compiler does not
emit a line note after the prologue in certain cases (typically
for empty functions).  Now it looks like that final_scan_insn
actually tries to ensure the presence of this information,
but it doesn't work correctly.

This is because final_scan_insn emits this note only after
it sees both the NOTE_INSN_PROLOGUE_END and NOTE_INSN_FUNCTION_BEG
notes.  However, in an empty function, the NOTE_INSN_FUNCTION_BEG
note actually lies *after* the first (and last) basic block, so
the the epilogue RTL will be threaded *before* NOTE_INSN_FUNCTION_BEG.

There is already code in thread_prologue_and_epilogue that moves
line note that fell after the epilogue, and I've extended this code
to move NOTE_INSN_FUNCTION_{BEG|END} as well.  This fixes the four
gdb test suite cases.

Bootstrapped/regtested on s390-ibm-linux and s390x-ibm-linux,
ran the gdb test suite without regressions (four cases fixed).
OK? 

Bye,
Ulrich

ChangeLog:

	* function.c (thread_prologue_and_epilogue): Move
	NOTE_INSN_FUNCTION_END and NOTE_INSN_FUNCTION_BEG notes
	before the epilogue.

Index: gcc/function.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/function.c,v
retrieving revision 1.505
diff -c -p -r1.505 function.c
*** gcc/function.c	14 Mar 2004 22:26:05 -0000	1.505
--- gcc/function.c	25 Mar 2004 03:02:55 -0000
*************** epilogue_done:
*** 8014,8024 ****
  
        /* Similarly, move any line notes that appear after the epilogue.
           There is no need, however, to be quite so anal about the existence
! 	 of such a note.  */
        for (insn = epilogue_end; insn; insn = next)
  	{
  	  next = NEXT_INSN (insn);
! 	  if (GET_CODE (insn) == NOTE && NOTE_LINE_NUMBER (insn) > 0)
  	    reorder_insns (insn, insn, PREV_INSN (epilogue_end));
  	}
      }
--- 8014,8029 ----
  
        /* Similarly, move any line notes that appear after the epilogue.
           There is no need, however, to be quite so anal about the existence
! 	 of such a note.  Also move the NOTE_INSN_FUNCTION_END and (possibly)
! 	 NOTE_INSN_FUNCTION_BEG notes, as those can be relevant for debug
! 	 info generation.  */
        for (insn = epilogue_end; insn; insn = next)
  	{
  	  next = NEXT_INSN (insn);
! 	  if (GET_CODE (insn) == NOTE 
! 	      && (NOTE_LINE_NUMBER (insn) > 0
! 		  || NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_BEG
! 		  || NOTE_LINE_NUMBER (insn) == NOTE_INSN_FUNCTION_END))
  	    reorder_insns (insn, insn, PREV_INSN (epilogue_end));
  	}
      }
-- 
  Dr. Ulrich Weigand
  weigand@informatik.uni-erlangen.de


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]