[Committed] PR rtl-optimization/22053: reg-stack clean-up thinko

Roger Sayle roger@eyesopen.com
Tue Jun 14 05:56:00 GMT 2005


My apologies to the Ada folks who've been bitten by a mistake in my
recent clean-up of reg-stack.c.   I made the classic beginner's mistake
of believing the comment in the original code, instead of carefully
reading/checking the implementation.

The misleading comment that I preserved in the clean-up reads:

      /* Assert that the lifetimes are as we expect -- one value
         live at st(0) on the end of the source block, and no
         values live at the beginning of the destination block.  */

however tucked away inside the original complex code that performed
comparisons of register sets using GO_IF_HARD_REG_EQUAL was hidden
the additional qualifying factlet:

      /* For complex return values, we may have st(1) live as well.  */

Doh!!


Although I've not yet attempted applying the additional set of patches
required to get the Ada front-end to build on mainline, I'm fairly certain
that the fix below should resolve the ACATS failures described in the PR.

The following patch has been bootstrapped on i686-pc-linux-gnu, all
default languages (which excludes Ada), and regression tested with a
top-level "make -k check" with no new failures.

Committed to mainline CVS as obvious.  If anyone can reduce a C or C++
testcase, that would be great.  My apologies again for the inconvenience.



2005-06-13  Roger Sayle  <roger@eyesopen.com>

	PR rtl-optimization/22053
	* reg-stack.c (compensate_edge): Correct mistake in the assertion
	checking of EDGE_ABNORMAL_CALL edges; complex return values can
	result in the top two stack slots, st(0) and st(1), being live.


Index: reg-stack.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reg-stack.c,v
retrieving revision 1.183
diff -c -3 -p -r1.183 reg-stack.c
*** reg-stack.c	4 Jun 2005 22:05:35 -0000	1.183
--- reg-stack.c	14 Jun 2005 01:37:02 -0000
*************** compensate_edge (edge e, FILE *file)
*** 2667,2674 ****
      {
        /* Assert that the lifetimes are as we expect -- one value
           live at st(0) on the end of the source block, and no
!          values live at the beginning of the destination block.  */
!       gcc_assert (source_stack->top == 0);
        gcc_assert (target_stack->top == -1);
        return false;
      }
--- 2667,2675 ----
      {
        /* Assert that the lifetimes are as we expect -- one value
           live at st(0) on the end of the source block, and no
!          values live at the beginning of the destination block.
! 	 For complex return values, we may have st(1) live as well.  */
!       gcc_assert (source_stack->top == 0 || source_stack->top == 1);
        gcc_assert (target_stack->top == -1);
        return false;
      }


Roger
--



More information about the Gcc-patches mailing list