This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Internal Compiler error with gcc 3.3 & linux/kernel/sched.c file
- From: Juan Quintela <quintela at trasno dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Cc: Gwenole Beauchesne <gbeauchesne at mandrakesoft dot com>,Frederic Lepied <flepied at mandrakesoft dot com>
- Date: Tue, 17 Jun 2003 01:51:24 +0200
- Subject: Internal Compiler error with gcc 3.3 & linux/kernel/sched.c file
Hi
I found the following bug in gcc-3.3 for x86.
compiler:
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).
Error:
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:https://qa.mandrakesoft.com/> 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) -
(unsigned
long) (&((struct task_struct *)
0)->run_list)));
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"
"1:\t"
"popl %%ebp\n\t"
"popl %%edi\n\t"
"popl %%esi\n\t"
:"=m" (prev->esp),
"=m"(prev->eip),
"=b"(prev)
:"m"(next->esp),
"m"(next->eip),
"a"(prev),
"d"(next),
"b"(prev));
}
--
In theory, practice and theory are the same, but in practice they
are different -- Larry McVoy