Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Jun 2002 11:16:44 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        current@FreeBSD.ORG
Cc:        obrien@FreeBSD.ORG
Subject:   Re: memset() broken in gcc-3.1 on i386's
Message-ID:  <20020604110707.H1982-100000@gamplex.bde.org>
In-Reply-To: <20020604084202.Q939-100000@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 4 Jun 2002, I wrote:

> gcc now generates inline code for memset in some cases.  Broken code.

Actually, it only generates inline code for memset in a few more cases,
and the case of a non-constant length is broken (and some cases of
constant lengths are pessimized (e.g., length 7)).

> ...
> This broke newfs (newfs left some garbage in a bitmap).

Actually, it broke fsck_ffs.

Workaround to avoid the known broken case:

%%%
Index: builtins.c
===================================================================
RCS file: /home/ncvs/src/contrib/gcc/builtins.c,v
retrieving revision 1.1.1.3
diff -u -2 -r1.1.1.3 builtins.c
--- builtins.c	13 May 2002 03:35:47 -0000	1.1.1.3
+++ builtins.c	4 Jun 2002 00:53:22 -0000
@@ -2195,4 +2195,9 @@
       len_rtx = expand_expr (len, NULL_RTX, VOIDmode, 0);

+      /* Give up for non-constant lengths.  They are broken on at least
+	 i386's.  */
+      if (GET_CODE (len_rtx) != CONST_INT)
+	return 0;
+
       dest_mem = get_memory_rtx (dest);
       set_mem_align (dest_mem, dest_align);
%%%

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020604110707.H1982-100000>