egcs-20000131 c++ inline code generation broken

Martin Buchholz martin@xemacs.org
Tue Feb 8 03:02:00 GMT 2000


>>>>> "ZW" == Zack Weinberg <zack@wolery.cumb.org> writes:

ZW> Odds are that the bug was fixed by this patch:

ZW> 2000-02-04  Richard Henderson  <rth@cygnus.com>

ZW>         * integrate.c (expand_inline_function): Revert 19 Jan change.

I am sorry to report that this inlining bug is still there in
egcs-20000207.  Again I offer access to my machine if provided with an
ssh public key.  A reproducible test case is worth its weight in electrons.

Don't try reproducing it on CVS XEmacs 21.2.  That has my egcs bug
workaround patch applied.

I also found another workaround that sheds light on the bug.

Recap: The original bug concerned C++ inlining a function with 6
arguments, one of which has its address taken.  This is a rare enough
operation that one can see how the compiler can easily get it wrong -
it wants arguments to be in registers, maybe.

If I copy the argument to an auto variable, and take the argument of
_that_, the problem goes away.  I really hope this is ringing some bells.

Index: minibuf.c
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/src/minibuf.c,v
retrieving revision 1.9.2.5
diff -u -U8 -r1.9.2.5 minibuf.c
--- minibuf.c	2000/02/07 07:59:46	1.9.2.5
+++ minibuf.c	2000/02/08 10:54:33
@@ -705,57 +705,52 @@
 echo_area_append (struct frame *f, CONST Bufbyte *nonreloc, Lisp_Object reloc,
 		  Bytecount offset, Bytecount length,
 		  Lisp_Object label)
 {
   /* This function can call lisp */
   Lisp_Object obj;
   struct gcpro gcpro1;
   Lisp_Object frame;
+  Lisp_Object length_on_the_stack = length;
 
-  /* There is an inlining bug in egcs-20000131 c++ that can be worked
-     around as follows:  */
-#if defined (__GNUC__) && defined (__cplusplus)
-  alloca (4);
-#endif
-
   /* some callers pass in a null string as a way of clearing the echo area.
      check for length == 0 now; if this case, neither nonreloc nor reloc
      may be valid.  */
-  if (length == 0)
+  if (length_on_the_stack == 0)
     return;
 
-  fixup_internal_substring (nonreloc, reloc, offset, &length);
+  fixup_internal_substring (nonreloc, reloc, offset, &length_on_the_stack);
 
   /* also check it here, in case the string was really blank. */
-  if (length == 0)
+  if (length_on_the_stack == 0)
     return;
 
   if (!NILP (Ffboundp (Qappend_message)))
     {
-      if (STRINGP (reloc) && offset == 0 && length == XSTRING_LENGTH (reloc))
+      if (STRINGP (reloc) && offset == 0 && length_on_the_stack == XSTRING_LENGTH (reloc))
 	obj = reloc;
       else
 	{
 	  if (STRINGP (reloc))
 	    nonreloc = XSTRING_DATA (reloc);
-	  obj = make_string (nonreloc + offset, length);
+	  obj = make_string (nonreloc + offset, length_on_the_stack);
 	}
 
       XSETFRAME (frame, f);
       GCPRO1 (obj);
       call4 (Qappend_message, label, obj, frame,
 	     EQ (label, Qprint) ? Qt : Qnil);
       UNGCPRO;
     }
   else
     {
       if (STRINGP (reloc))
 	nonreloc = XSTRING_DATA (reloc);
-      write_string_to_stdio_stream (stderr, 0, nonreloc, offset, length,
+      write_string_to_stdio_stream (stderr, 0, nonreloc, offset, length_on_the_stack,
 				    Qterminal);
     }
 }


More information about the Gcc-bugs mailing list