This is the mail archive of the 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]
Other format: [Raw text]

Internal Compiler error with gcc 3.3 & linux/kernel/sched.c file

        I found the following bug in gcc-3.3 for x86.
quintela$ gcc -v
Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3/specs
Configured with: ../configure --prefix=/usr --libdir=/usr/lib --with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --enable-long-long --enable-__cxa_atexit --enable-languages=c,c++,ada,f77,objc,java --host=i586-mandrake-linux-gnu --target=i586-mandrake-linux-gnu --with-system-zlib
Thread model: posix
gcc version 3.3 (Mandrake Linux 9.2 3.3-1mdk)

It also happens with gcc shipped with debian.

Program compiles prefectly with gcc 3.2.3.

Command line:

gcc -O2 prog.c

(without the -O2 gives a different error message).

gcc version 3.3 (Mandrake Linux 9.2 3.3-1mdk)
quintela$ gcc -O2 kk2.c -c
kk2.c: In function `schedule':
kk2.c:30: warning: passing arg 1 of `strcmp' discards qualifiers from pointer target type
kk2.c:53: internal compiler error: in merge_assigned_reloads, at reload1.c:6134
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:> for instructions.

Notice that I removed *lots* of things of the file to make a simple
test case.  File in question is kernel/sched.c of the Linux Kernel
with swsuspend patch.

If you preffer full preprocessed file, I can send it to you (~12lines
of C code).

Thanks in advance, Juan.

PD. Yes, I know that the __switch_to label is not on that file, but I
   reduced the test case to the minimal expresion that reproduced the
   bug, indeed if the resulting file don't make sense.

int strcmp(const char *cs, const char *ct);
int printk(const char *fmt);

struct list_head {
	struct list_head *next;

struct task_struct {
	unsigned long eip;
	unsigned long esp;
	struct list_head run_list;
	char comm[16];

void schedule(void)
	struct task_struct volatile *prev, *next, *p;
	struct list_head *tmp;

	for (tmp = (struct list_head *) 1; tmp != (struct list_head *) 2;
	     tmp = tmp->next) {
		p = ((struct task_struct *) ((char *) (tmp) -
					      long) (&((struct task_struct *)
		next = p;

	if (__builtin_expect((strcmp(next->comm, "swapper") != 0), 0))
		printk("Scheduling suspended task %s!\n");

	asm volatile ("pushl %%esi\n\t"
		      "pushl %%edi\n\t"
		      "pushl %%ebp\n\t"
		      "movl %%esp,%0\n\t"
		      "movl %3,%%esp\n\t"
		      "movl $1f,%1\n\t"
		      "pushl %4\n\t"
		      "jmp __switch_to\n" 
		      "popl %%ebp\n\t"
		      "popl %%edi\n\t"
		      "popl %%esi\n\t"
		      :"=m" (prev->esp),

In theory, practice and theory are the same, but in practice they 
are different -- Larry McVoy

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