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]

ICE in fixup_var_refs_1 while compiling libc


While compiling CVS glibc with CVS gcc, last night:

cc1 getlogin_r.i -quiet -dumpbase getlogin_r.c -g -O2 -o getlogin_r.s
    -Wall -Winline -Wstrict-prototypes -Wwrite-strings -version
GNU C version 2.96 20000313 (experimental) (i686-pc-linux-gnu)
compiled by GNU C version 2.96 20000313 (experimental).
getlogin_r.i: In function `getlogin_r':
getlogin_r.i:93: Internal compiler error in `fixup_var_refs_1',
		 at function.c:1836

(gdb) bt
#0  fancy_abort (file=0x8205253 "/work/src/gcc/gcc/function.c", line=1836, 
    function=0x820528b "fixup_var_refs_1") at /work/src/gcc/gcc/rtl.c:1249
#1  0x8067006 in fixup_var_refs_1 (var=0x40110210, promoted_mode=SImode, 
    loc=0x40114824, insn=0x40111d60, replacements=0xbffff20c)
    at /work/src/gcc/gcc/function.c:1836
#2  0x8067b86 in fixup_var_refs_1 (var=0x40110210, promoted_mode=SImode, 
    loc=0x40110c94, insn=0x40111d60, replacements=0xbffff20c)
    at /work/src/gcc/gcc/function.c:2365
#3  0x8067b86 in fixup_var_refs_1 (var=0x40110210, promoted_mode=SImode, 
    loc=0x40110ca8, insn=0x40111d60, replacements=0xbffff20c)
    at /work/src/gcc/gcc/function.c:2365
#4  0x8067b86 in fixup_var_refs_1 (var=0x40110210, promoted_mode=SImode, 
    loc=0x40111d70, insn=0x40111d60, replacements=0xbffff20c)
    at /work/src/gcc/gcc/function.c:2365
#5  0x8066e19 in fixup_var_refs_insns (var=0x40110210, promoted_mode=SImode, 
    unsignedp=1, insn=0x4010c860, toplevel=1, ht=0xbffff3b4)
    at /work/src/gcc/gcc/function.c:1719
#6  0x80669f6 in fixup_var_refs (var=0x40110210, promoted_mode=SImode, 
    unsignedp=1, ht=0xbffff3b4) at /work/src/gcc/gcc/function.c:1512
#7  0x8066997 in put_reg_into_stack (function=0x0, reg=0x40110210, 
    type=0x4010b880, promoted_mode=SImode, decl_mode=SImode, volatile_p=0, 
    original_regno=30, used_p=1, ht=0xbffff3b4)
    at /work/src/gcc/gcc/function.c:1496
#8  0x806843d in put_addressof_into_stack (r=0x40110220, ht=0xbffff3b4)
    at /work/src/gcc/gcc/function.c:2799
#9  0x8068a22 in purge_addressof_1 (loc=0x401102a8, insn=0x401110a0, force=0, 
    store=0, ht=0xbffff3b4) at /work/src/gcc/gcc/function.c:3079
#10 0x80684ac in purge_addressof_1 (loc=0x401110b0, insn=0x401110a0, force=0, 
    store=0, ht=0xbffff3b4) at /work/src/gcc/gcc/function.c:2850
#11 0x8068d7e in purge_addressof (insns=0x4010c860)
    at /work/src/gcc/gcc/function.c:3258
#12 0x804cb55 in rest_of_compilation (decl=0x4010bd00)
    at /work/src/gcc/gcc/toplev.c:3132

(gdb) l
1831    
1832          /* We should be able to replace with a register or all is lost.
1833             Note that we can't use validate_change to verify this, since
1834             we're not caring for replacing all dups simultaneously.  */
1835          if (! validate_replace_rtx (*loc, y, insn))
1836            abort ();

(gdb) call debug_rtx(*loc)

(addressof:SI (mem/f:SI (plus:SI (reg:SI 20 frame)
            (const_int -1284 [0xfffffafc])) 6) 30 0x4010d700)

(gdb) call debug_rtx(y)
(reg:SI 68)

(gdb) call debug_rtx(insn)
(insn 195 162 165
   (set (reg:SI 55)
        (plus:SI (mem:SI (addressof:SI 
			     (mem/f:SI (plus:SI (reg:SI 20 frame)
				       (const_int -1284 [0xfffffafc]))
			      6)
			  30 0x4010d700)
	          6)
                 (const_int 44 [0x2c])))
   -1 (nil) (nil))

;; I don't like the looks of that insn.

Test case is appended.

zw

typedef unsigned int size_t;
struct timeval
{
  long int tv_sec;
  long int tv_usec;
};
struct exit_status
{
  short int e_termination;
  short int e_exit;
};
struct utmp
{
  short int ut_type;
  int ut_pid;
  char ut_line[32];
  char ut_id[4];
  char ut_user[32];
  char ut_host[256];
  struct exit_status ut_exit;

  long int ut_session;
  struct timeval ut_tv;
  int ut_addr_v6[4];
  char __unused[20];
};

extern int *__errno_location (void) __attribute__ ((__const__));
extern size_t strlen (__const char *__s);
extern char *strncpy (char *__restrict __dest,
		      __const char *__restrict __src, size_t __n);
extern void *memcpy (void *__restrict __dest,
		     __const void *__restrict __src, size_t __n);
extern int __ttyname_r (int __fd, char *__buf, size_t __buflen);
extern void __setutent (void);
extern void __endutent (void);
extern int __getutline_r (__const struct utmp *__line,
			  struct utmp *__buffer, struct utmp **__result);
extern int getlogin_r (char *__name, size_t __name_len);

int
getlogin_r (name, name_len)
     char *name;
     size_t name_len;
{
  char tty_pathname[2 + 2 * 255];
  char *real_tty_path = tty_pathname;
  int result = 0;
  struct utmp *ut, line, buffer;

  result = __ttyname_r (0, real_tty_path, sizeof (tty_pathname));

  if (result != 0)
    return result;

  real_tty_path += 5;

  __setutent ();
  
  (__extension__
   (__builtin_constant_p (real_tty_path)
    && __builtin_constant_p (sizeof line.ut_line)
    ? (strlen (real_tty_path) + 1 >= ((size_t) (sizeof line.ut_line))
	? (char *) memcpy (line.ut_line, real_tty_path, sizeof line.ut_line)
	: strncpy (line.ut_line, real_tty_path, sizeof line.ut_line))
    : strncpy (line.ut_line, real_tty_path, sizeof line.ut_line)));
  if (__getutline_r (&line, &buffer, &ut) < 0)
    {
      if ((*__errno_location ()) == 3)

	result = 2;
      else
	result = (*__errno_location ());
    }
  else
    {
      size_t needed = strlen (ut->ut_user) + 1;

      if (needed > name_len)
	{
	  (*__errno_location ()) = (34);
	  result = 34;
	}
      else
	{
	  memcpy (name, ut->ut_user, needed);
	  result = 0;
	}
    }
  __endutent ();

  return result;
}

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