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]

patch: solaris2.6 problem solved


Hello,

Some time ago I sent a bug report about compilation problems on
sparc-sun-solaris2.6. The code:

long double
bug(long double src)
{
	if (src > -0.1 && src < 0.1) {
		int i;
		long double r = 1.0;
		long double k = 1.0;
		long double s = 0.0;
		for (i = 1 ; i < 10 ; i++) {
			r *= src;
			k *= (long double)i;
			s += r / k;
		}
		src = s;
	}
	return src;
}

generates the output below when compiled with -O2:

bug.c: In function `bug':
bug.c:17: Internal compiler error in schedule_insns, at sched-rgn.c:3070
Please submit a full bug report, with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

I did debug this problem and found that the patch below fixed the problem.
I do not know why this was changed or how this should work. I only know
that this patch fixes the problem.
This code works for gcc 2.95.2 (I did not check 2.95.3 yet) and is a
regression for gcc 3.0.
Perhaps the above test case can be added to the testsuite.
I do not have write permission so can not make the change after
aproval.

	Herman.


2001-03-28 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>

	* calls.c (emit_library_call_value_1): Restore gcc 2.95.2 code when
	args are passed by reference.


--- calls.c.org	Wed Mar 28 17:14:59 2001
+++ calls.c	Wed Mar 28 17:14:35 2001
@@ -3663,44 +3663,12 @@ emit_library_call_value_1 (retval, orgfu
 #ifdef FUNCTION_ARG_PASS_BY_REFERENCE
       if (FUNCTION_ARG_PASS_BY_REFERENCE (args_so_far, mode, NULL_TREE, 1))
 	{
-	  rtx slot;
-	  int must_copy = 1
-#ifdef FUNCTION_ARG_CALLEE_COPIES	  
-	    && ! FUNCTION_ARG_CALLEE_COPIES (args_so_far, mode,
-					     NULL_TREE, 1)
-#endif
-	    ;
-
-	  if (GET_MODE (val) == MEM && ! must_copy)
-	    slot = val;
-	  else if (must_copy)
-	    {
-	      slot = assign_temp (type_for_mode (mode, 0), 0, 1, 1);
-	      emit_move_insn (slot, val);
-	    }
-	  else
-	    {
-	      tree type = type_for_mode (mode, 0);
-
-	      slot = gen_rtx_MEM (mode,
-				  expand_expr (build1 (ADDR_EXPR,
-						       build_pointer_type
-						       (type),
-						       make_tree (type, val)),
-					       NULL_RTX, VOIDmode, 0));
-	    }
-
-	  call_fusage = gen_rtx_EXPR_LIST (VOIDmode,
-					   gen_rtx_USE (VOIDmode, slot),
-					   call_fusage);
-	  if (must_copy)
-	    call_fusage = gen_rtx_EXPR_LIST (VOIDmode,
-					     gen_rtx_CLOBBER (VOIDmode,
-							      slot),
-					     call_fusage);
-
-	  mode = Pmode;
+	  /* We do not support FUNCTION_ARG_CALLEE_COPIES here since it can
+	     be viewed as just an efficiency improvement.  */
+	  rtx slot = assign_stack_temp (mode, GET_MODE_SIZE (mode), 0);
+	  emit_move_insn (slot, val);
 	  val = force_operand (XEXP (slot, 0), NULL_RTX);
+	  mode = Pmode;
 	}
 #endif
 


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