egcs-970828 bug with -fprofile-arcs

Jim Wilson wilson@chestnut.cygnus.com
Wed Sep 3 16:31:00 GMT 1997


I reproduced the problem with a native linux build.

Looking at the pgcc patch, the first 3 hunks are wrong, and I can't tell
if the last hunk is right or not, so I am ignoring it.

I wrote my own patch to fix this problem.  All that was missing was a test
for GET_CODE () == INSN after skipping the stack pop.

Wed Sep  3 16:26:02 1997  Jim Wilson  <wilson@cygnus.com>

	* profile.c (output_arc_profiler): Verify next_insert_after is an
	INSN before and after skipping a stack pop.

Index: profile.c
===================================================================
RCS file: /cvs/cvsfiles/egcs/gcc/profile.c,v
retrieving revision 1.1.1.1
diff -p -r1.1.1.1 profile.c
*** profile.c	1997/08/11 15:57:12	1.1.1.1
--- profile.c	1997/09/03 23:25:48
*************** output_arc_profiler (arcno, insert_after
*** 1536,1548 ****
        rtx return_reg;
        rtx next_insert_after = next_nonnote_insn (insert_after);
  
        if (GET_CODE (next_insert_after) == INSN)
  	{
- 	  /* The first insn after the call may be a stack pop, skip it.  */
- 	  if (GET_CODE (PATTERN (next_insert_after)) == SET
- 	      && SET_DEST (PATTERN (next_insert_after)) == stack_pointer_rtx)
- 	    next_insert_after = next_nonnote_insn (next_insert_after);
- 
  	  if (GET_CODE (PATTERN (insert_after)) == SET)
  	    return_reg = SET_DEST (PATTERN (insert_after));
  	  else
--- 1536,1549 ----
        rtx return_reg;
        rtx next_insert_after = next_nonnote_insn (insert_after);
  
+       /* The first insn after the call may be a stack pop, skip it.  */
+       if (GET_CODE (next_insert_after) == INSN
+ 	  && GET_CODE (PATTERN (next_insert_after)) == SET
+ 	  && SET_DEST (PATTERN (next_insert_after)) == stack_pointer_rtx)
+ 	next_insert_after = next_nonnote_insn (next_insert_after);
+ 
        if (GET_CODE (next_insert_after) == INSN)
  	{
  	  if (GET_CODE (PATTERN (insert_after)) == SET)
  	    return_reg = SET_DEST (PATTERN (insert_after));
  	  else



More information about the Gcc-bugs mailing list