This is the mail archive of the gcc-bugs@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]

Re: ICE with glibc and current egcs


Dear Ulrich Drepper, 

dear egcs gurus,

with the current (CVS) egcs, I'm running into problems way before
compiling utmpd.c in glibc-2.1.2; I'm using an ix86 GNU/Linux box with
Linux-2.2.12, binutils-2.9.5.0.14, make-2.78.1.

The compilation stops with this error message:

gcc ../sysdeps/unix/sysv/linux/semctl.c -c -O -Wall -Winline -Wstrict-prototypes -Wwrite-strings -g      -I../include -I. -I/home/ernst/devel/glibc-bin/sysvipc -I.. -I../libio  -I/home/ernst/devel/glibc-bin -I../sysdeps/i386/elf -I../linuxthreads/sysdeps/unix/sysv/linux -I../linuxthreads/sysdeps/pthread -I../linuxthreads/sysdeps/unix/sysv -I../linuxthreads/sysdeps/unix -I../linuxthreads/sysdeps/i386/i686 -I../linuxthreads/sysdeps/i386 -I../crypt/sysdeps/unix -I../sysdeps/unix/sysv/linux/i386/i686 -I../sysdeps/unix/sysv/linux/i386 -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../sysdeps/unix/sysv/i386 -I../sysdeps/unix/sysv -I../sysdeps/unix/i386 -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/i386/i686 -I../sysdeps/i386/i486 -I../sysdeps/libm-i387/i686 -I../sysdeps/i386/fpu -I../sysdeps/libm-i387 -I../sysdeps/i386 -I../sysdeps/wordsize-32 -I../sysdeps/ieee754 -I../sysdeps/libm-ieee754 -I../sysdeps/gener!
ic/elf -I../sysdeps/generic   -D_LIBC_REENTRANT -include ../include/libc-symbols.h     -o /home/ernst/devel/glibc-bin/sysvipc/semctl.o
../sysdeps/unix/sysv/linux/semctl.c: In function `semctl':
../sysdeps/unix/sysv/linux/semctl.c:49: invalid lvalue in unary `&'
../sysdeps/unix/sysv/linux/semctl.c:43: warning: `arg' might be used uninitialized in this function

The function semctl

 int
 semctl (int semid, int semnum, int cmd, ...)
 {
   union semun *arg;
   va_list ap;   

   va_start (ap, cmd);

   /* Get a pointer the argument.  */
   arg = &va_arg (ap, union semun);  /* THIS IS LINE 49  [comment added by em] */ 

   va_end (ap);

   return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd, arg);
 }

is preprocessed to 

 int
 semctl (int semid, int semnum, int cmd, ...)
 {
   union semun *arg;
   va_list ap;

   __builtin_stdarg_start(&( ap ),  cmd ) ;

   
   arg = & __builtin_va_arg  (ap, union semun);

   __builtin_va_end  (ap);

   return ({	unsigned int resultvar;	asm volatile (	"bpushl .L__X'%k2, %k2\n\t"	"bmovl .L__X'%k2, %k2\n\t"   	"movl %1, %%eax\n\t"	"int $0x80\n\t"	"bpopl .L__X'%k2, %k2\n\t"   	: "=a" (resultvar)	: "i" (117  ) , "a" (   3  ), "c" (  semid ), "d" (  semnum ), "S" (  cmd ), "D" (  arg  )  : "memory", "cc");	if (resultvar >= 0xfffff001)	{	(*__errno_location ()) = ( -resultvar ) ;	resultvar = 0xffffffff;	}	(int) resultvar; }) ;
 }

by the current version of egcs, while gcc 2.95.1 produces 

 int
 semctl (int semid, int semnum, int cmd, ...)
 {
   union semun *arg;
   va_list ap; 

   ( ap  = ((__gnuc_va_list) __builtin_next_arg (  cmd ))) ;

   
   arg = & ( ap  = (__gnuc_va_list) ((char *) ( ap ) + (((sizeof (   union semun  ) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) ),	*((  union semun  *) (void *) ((char *) ( ap ) - (((sizeof (   union semun  ) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) ))) ;
 
   ((void)0) ;

   return ({	unsigned int resultvar;	asm volatile (	"bpushl .L__X'%k2, %k2\n\t"	"bmovl .L__X'%k2, %k2\n\t"   	"movl %1, %%eax\n\t"	"int $0x80\n\t"	"bpopl .L__X'%k2, %k2\n\t"   	: "=a" (resultvar)	: "i" (117  ) , "a" (   3  ), "c" (  semid ), "d" (  semnum ), "S" (  cmd ), "D" (  arg  )  : "memory", "cc");	if (resultvar >= 0xfffff001)	{	(*__errno_location ()) = ( -resultvar ) ;	resultvar = 0xffffffff;	}	(int) resultvar; }) ;
 }

As an aside, the current egcs causes segfaults for other code based on
the use of variadic functions, too, for instance, the string functions
of the glib (part of the GTK toolkit) fail to work.

With many thanks for glibc and all the other fine GNU packages, 

Ernst Molitor

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