libc/strings/tester.c problems

Nick Jones gwaidzai@yahoo.com.hk
Mon Jan 13 04:56:00 GMT 2003


In order for one of the test binaries (inl-tester.o) to compile, I had 
to make the following change to libc/strings/tester.c:

diff -Nur libc/string/tester.c libc-test/string/tester.c
--- libc/string/tester.c        2003-01-12 14:46:58.000000000 +0800
+++ libc-test/string/tester.c   2003-01-12 23:31:16.000000000 +0800
@@ -175,7 +175,7 @@
   SIMPLE_COPY(strcpy, 16, "6666666666666666", 57);
 
   /* Simple test using implicitly coerced `void *' arguments.  */
-  const void *src = "frobozz";
+  const char *src = "frobozz";
   void *dst = one;
   check (strcpy (dst, src) == dst, 1);
   equal (dst, "frobozz", 2);

Although this change sort of makes the test pointless.

Before this change, the error received was:

In file included from inl-tester.c:6:
tester.c: In function `test_strcpy':
tester.c:180: error: void value not ignored as it ought to be (repeated 32x)
make[2]: *** [/usr/src/build-glibc/string/inl-tester.o] Error 1

At first I thought this may be a gcc bug, but I tried the following 
simple duplication: test.c

#define DO_STRING_INLINES
#undef __USE_STRING_INLINES
#define __USE_STRING_INLINES 1

#include <string.h>

int main ()
{
  char* one[50];

  const void* src = "hello";
  void* dst = one;

  strcpy (dst, src);

  return 0;
}

compiled simply with: gcc -c test.c -o test.o, no errors or warnings, 
but when I compiled with flags identical to inl-tester.o: (this Makefile 
is recreated based on the output of the glibc build)

test.o: test.c
        gcc test.c -c -std=gnu99 -O3 \
        -Wall -Winline -Wstrict-prototypes -Wwrite-strings -march=i686 \
        -I/usr/src/libc-test/include -I. -I/usr/src/build-glibc/string -I/usr/src/libc-test
-I/usr/src/libc-test/libio -I/usr/src/build-glibc -I/usr/src/libc-test/sysdeps/i386/elf
-I/usr/src/libc-test/nptl/sysdeps/unix/sysv/linux/i386/i686
-I/usr/src/libc-test/nptl/sysdeps/unix/sysv/linux/i386 
-I/usr/src/libc-test/nptl/sysdeps/unix/sysv/linux -I/usr/src/libc-test/nptl/sysdeps/pthread
-I/usr/src/libc-test/sysdeps/pthread -I/usr/src/libc-test/nptl/sysdeps/unix/sysv
-I/usr/src/libc-test/nptl/sysdeps/unix -I/usr/src/libc-test/nptl/sysdeps/i386/i686
-I/usr/src/libc-test/nptl/sysdeps/i386 -I/usr/src/libc-test/sysdeps/unix/sysv/linux/i386/i686
-I/usr/src/libc-test/sysdeps/unix/sysv/linux/i386 -I/usr/src/libc-test/sysdeps/unix/sysv/linux
-I/usr/src/libc-test/sysdeps/gnu -I/usr/src/libc-test/sysdeps/unix/common
-I/usr/src/libc-test/sysdeps/unix/mman -I/usr/src/libc-test/sysdeps/unix/inet
-I/usr/src/libc-test/sysdeps/unix/sysv/i386/i686 -I/usr/src/libc-test/sysdeps/unix/sysv/i386
-I/usr/src/libc-test/sysdeps/unix/sysv -I/usr/src/libc-test/sysdeps/unix/i386/i686
-I/usr/src/libc-test/sysdeps/unix/i386 -I/usr/src/libc-test/sysdeps/unix
-I/usr/src/libc-test/sysdeps/posix -I/usr/src/libc-test/sysdeps/i386/i686/fpu
-I/usr/src/libc-test/sysdeps/i386/i686 -I/usr/src/libc-test/sysdeps/i386/i486
-I/usr/src/libc-test/nptl/sysdeps/i386/i486 -I/usr/src/libc-test/sysdeps/i386/fpu
-I/usr/src/libc-test/sysdeps/i386 -I/usr/src/libc-test/sysdeps/wordsize-32
-I/usr/src/libc-test/sysdeps/ieee754/ldbl-96 -I/usr/src/libc-test/sysdeps/ieee754/dbl-64
-I/usr/src/libc-test/sysdeps/ieee754/flt-32 -I/usr/src/libc-test/sysdeps/ieee754
-I/usr/src/libc-test/sysdeps/generic/elf -I/usr/src/libc-test/sysdeps/generic \
        -nostdinc \
        -isystem /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3/include \
        -isystem /usr/src/linux-2.5.56/include \
        -D_LIBC_REENTRANT -D_LIBC_REENTRANT \
        -include /usr/src/libc-test/include/libc-symbols.h \
        -DNOT_IN_libc=1 \
        -o test.o

the error is reproduced.  I guess that since no binaries are linked in this step, the problem could be in a header file.

my setup is:
i686
kernel 2.5.56
GNU ld version 021226 20021226
gcc version 3.3 20030106 (prerelease)
glibc 2.2.5

Thanks

  Nick




More information about the Libc-alpha mailing list