This is the mail archive of the libc-alpha@cygnus.com mailing list for the glibc project.


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

Re: make check failure in glibc 2.0.109



>>>>> Joel Klecker writes:
>> Synopsis:	make check failure
	
Joel> Host type: i386-pc-linux-gnu

Joel> [...]
Joel> ../sysdeps/i386/bits/string.h:135: warning: control reaches end of non-void function
Joel> ../sysdeps/i386/bits/string.h: In function `__memset_cc':
Joel> ../sysdeps/i386/bits/string.h:226: warning: control reaches end of non-void function
Joel> ../sysdeps/i386/bits/string.h: In function `test_strspn':
Joel> ../sysdeps/i386/bits/string.h:636: `asm' needs too many reloads

Hi Joel,

Maciej has sent the appended patch which might solve your problem.
AFAIK nobody looked into the email so far (I didn't see a reply to
it).  Ulrich, what's wrong with the patch?  We really need to fix
sysdeps/i386/bits/string.h!

Maciej even wrote:
> 	  Also some switch instructions make egcs issue warnings.  As this
> 	  is a header file which is being included by various programs
> 	  some people might find annoying these messages.
> 
> 	  I will fix the entire file if you agree with me in these aspects.

If his patch is ok, we should encourage him to clean up the header.

Andreas
-- 
 Andreas Jaeger   aj@arthur.rhein-neckar.de    jaeger@informatik.uni-kl.de
  for pgp-key finger ajaeger@aixd1.rhrk.uni-kl.de
------- Start of forwarded message -------
Date: Mon, 7 Dec 1998 17:01:01 +0100 (MET)
From: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
To: libc-alpha@cygnus.com
Subject: sysdeps/i386/bits/string.h contains bogus code
Message-ID: <Pine.GSO.3.96.981207165707.3020A-100000@delta.ds2.pg.gda.pl>
Organization: Technical University of Gdansk
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII

>Submitter-Id:	net
>Originator:	Maciej W. Rozycki
>Organization:
  -- 
  +  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
  +--------------------------------------------------------------+
  +        e-mail: macro@ds2.pg.gda.pl, PGP key available        +
>
>Confidential:	no
>Synopsis:	sysdeps/i386/bits/string.h contains bogus code
>Severity:	serious
>Priority:	medium
>Category:	libc
>Class:		sw-bug
>Release:	libc-2.0.105
>Environment:
Host type: i386-redhat-linux-gnu
System: Linux macro.ds2.pg.gda.pl 2.1.131 #1 SMP Sun Dec 6 03:27:11 CET 1998 i586 unknown
Architecture: i586

Addons: crypt linuxthreads
Build CFLAGS: -pipe -O2 -m486
Build CC: gcc
Compiler version: egcs-2.91.60 19981201 (egcs-1.1.1 release)
Kernel headers: 2.1.131
Symbol versioning: yes
Build static: yes
Build shared: yes
Build pic-default: no
Build profile: yes
Build omitfp: yes
Build bounded: no
Build static-nss: yes
Stdio: libio

>Description:
	It seems no one is using glibc on a plain i386 anymore as the
	file hasn't been changed since April...  The current version of
	sysdeps/i386/bits/string.h does not compile.  Even if
	syntactically corrected and compiled, it fails some of tests
	invoked by make check.
>How-To-Repeat:
	Configure libc for i386-*-linux and compile.
>Fix:
	The attached patch fixes the problem for me.  The library compiles
	and succeeds all tests.

	There is one important note, however.  The second hunk replaces
	the first input register of strcspn with "d".  This works around
	a problem which does not appear under standard tests but is
	exploitable for PIC (I performed the tests for PIC, too).  The
	third of tests: `check(strcspn("abc", "abc") == 0, 3);' fails
	for PIC with egcs-2.91.60.  Due to heavy optimizations both
	arguments are actually the same string, so the function gets
	two identical pointers.  So the compiler places both %0 and %4
	in the same register (%esi) assuming %0 will be unchanged for
	the whole span of __asm__.  I believe it to be a bug in egcs
	as the "&" constraint tells %0 will be clobbered and forbids its
	usage for input.  Setting %4 to "d" is ugly but %edx is usually
	used for it, anyway.  I think this particular change should be
	reversed as soon as egcs is fixed (some advice wrt necessary egcs
	version may be added to docs).

	I believe this file needs some purifications anyway -- some
	functions use %<number> notation and some reference registers
	explicitly.  This is ugly and tends to cause errors.

	Also some switch instructions make egcs issue warnings.  As this
	is a header file which is being included by various programs
	some people might find annoying these messages.

	I will fix the entire file if you agree with me in these aspects.

diff -u --recursive --new-file glibc-2.0.105.macro/sysdeps/i386/bits/string.h glibc-2.0.105/sysdeps/i386/bits/string.h
--- glibc-2.0.105.macro/sysdeps/i386/bits/string.h	Mon Nov 30 17:57:49 1998
+++ glibc-2.0.105/sysdeps/i386/bits/string.h	Sat Dec  5 23:31:39 1998
@@ -381,17 +381,19 @@
     ("cld\n\t"
      "repne; scasb\n\t"
      "decl	%1\n\t"
-     "movl	%5,%3\n"
+     "movl	%4,%2\n"
      "1:\n\t"
-     "decl	%3\n\t"
+     "decl	%2\n\t"
      "js	2f\n\t"
      "lodsb\n\t"
      "stosb\n\t"
      "testb	%%al,%%al\n\t"
-     "jne	1b\n"
+     "jne	1b\n\t"
+     "jmp	3f\n"
      "2:\n\t"
-     "xorl	%2,%2\n\t"
-     "stosb"
+     "xorl	%3,%3\n\t"
+     "stosb\n"
+     "3:"
      : "=&S" (__d0), "=&D" (__d1), "=&c" (__d2), "=&a" (__d3)
      : "g" (__n), "0" (__src), "1" (__dest), "2" (0xffffffff), "3" (0)
      : "memory", "cc");
@@ -543,7 +545,7 @@
      "2:\n\t"
      "popl	%%ebx"
      : "=&S" (__res), "=&a" (__d0), "=&c" (__d1), "=&D" (__d2)
-     : "r" (__reject), "1" (0), "2" (0xffffffff), "3" (__s),
+     : "d" (__reject), "0" (__s), "1" (0), "2" (0xffffffff)
      : "cc");
   return (__res - 1) - __s;
 }
@@ -632,7 +634,7 @@
      "je	1b\n"
      "2:"
      : "=&S" (__res), "=&a" (__d0), "=&c" (__d1), "=&d" (__d2), "=&D" (__d3)
-     : "g" (__accept), "0" (__s), "a" (0), "c" (0xffffffff)
+     : "g" (__accept), "0" (__s), "1" (0), "2" (0xffffffff)
      : "cc");
   return (__res - 1) - __s;
 }
@@ -682,7 +684,7 @@
   register char *__res;
   __asm__ __volatile__
     ("cld\n\t"
-     "movl	%4,%%edi\n\t"
+     "movl	%5,%%edi\n\t"
      "repne; scasb\n\t"
      "notl	%%ecx\n\t"
      "decl	%%ecx\n\t"
@@ -691,7 +693,7 @@
      "lodsb\n\t"
      "testb	%%al,%%al\n\t"
      "je	2f\n\t"
-     "movl	%4,%%edi\n\t"
+     "movl	%5,%%edi\n\t"
      "movl	%%edx,%%ecx\n\t"
      "repne; scasb\n\t"
      "jne	1b\n\t"
@@ -714,7 +716,7 @@
 __STRING_INLINE char *
 strstr (__const char *__haystack, __const char *__needle)
 {
-  register unsigned long int __d0, __d1, __d2, __d3;
+  register unsigned long int __d0, __d1, __d2;
   register char *__res;
   __asm__ __volatile__
     ("pushl	%%ebx\n\t"

------- End of forwarded message -------


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