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

regscan x86 abort


The attached function causes a segv in reg_scan_mark_refs because
we traverse a REG_WAS_0 note, and find a nil in the INSN stored
there.  Scanning the attached insn seems wrong.


r~
	* regclass.c (reg_scan_mark_refs): Don't traverse attached insns.

Index: regclass.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/regclass.c,v
retrieving revision 1.30
diff -c -p -d -r1.30 regclass.c
*** regclass.c	1998/08/25 11:02:48	1.30
--- regclass.c	1998/09/06 05:47:08
*************** reg_scan_mark_refs (x, insn, note_flag, 
*** 2006,2011 ****
--- 2006,2012 ----
      case LABEL_REF:
      case ADDR_VEC:
      case ADDR_DIFF_VEC:
+     case INSN:
        return;
  
      case REG:
struct task_struct {
	volatile long state;	 
	int sigpending;
};

struct wait_queue {
	struct task_struct * task;
	struct wait_queue * next;
};

static inline struct task_struct * get_current(void)
{
	struct task_struct *current;
	__asm__("andl %%esp,%0; ":"=r" (current) : "0" (~8191UL));
	return current;
}
 
extern inline int signal_pending(struct task_struct *p)
{
	return (p->sigpending != 0);
}

extern int fg_console, last_console, want_console;

void schedule(void);

extern inline void __add_wait_queue(struct wait_queue ** p, struct wait_queue * wait)
{
	wait->next = *p ? : ((struct wait_queue *)(( p )-1)) ;
	*p = wait;
}

extern inline void add_wait_queue(struct wait_queue ** p, struct wait_queue * wait)
{
	unsigned long flags;

	do { __asm__ __volatile__("pushfl ; popl %0":"=g" (    flags   ):   :"memory")  ; __asm__ __volatile__ ("cli": : :"memory")  ; } while (0) ;
	__add_wait_queue(p, wait);
	__asm__ __volatile__("pushl %0 ; popfl":   :"g" (    flags   ):"memory")   ;
}

extern inline void __remove_wait_queue(struct wait_queue ** p, struct wait_queue * wait)
{
	struct wait_queue * next = wait->next;
	struct wait_queue * head = next;
	struct wait_queue * tmp;

	while ((tmp = head->next) != wait) {
		head = tmp;
	}
	head->next = next;
}

extern inline void remove_wait_queue(struct wait_queue ** p, struct wait_queue * wait)
{
	unsigned long flags;

	do { __asm__ __volatile__("pushfl ; popl %0":"=g" (    flags   ):   :"memory")  ; __asm__ __volatile__ ("cli": : :"memory")  ; } while (0) ;
	__remove_wait_queue(p, wait);
	__asm__ __volatile__("pushl %0 ; popfl":   :"g" (    flags   ):"memory")   ; 
}

static struct wait_queue *vt_activate_queue = ((void *) 0) ;

int vt_waitactive(int vt)
{
	int retval;
	struct wait_queue wait = { get_current() , ((void *) 0)  };

	add_wait_queue(&vt_activate_queue, &wait);
	for (;;) {
		get_current() ->state = 1 ;
		retval = 0;
		if (vt == fg_console)
			break;
		retval = - 4 ;
		if (signal_pending(get_current() ))
			break;
		schedule();
	}
	remove_wait_queue(&vt_activate_queue, &wait);
	get_current() ->state = 0 ;
	return retval;
}

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