egcs 1.0.1 miscompiles Linux 2.0.33

Thomas Koenig ig25@mvmap66.ciw.uni-karlsruhe.de
Sat Jan 10 18:31:00 GMT 1998


[x-posted to linux-kernel and egcs mailing lists]

Compiling the Linux kernel 2.0.33 with haifa-enabled egcs 1.0.1 causes a
repeatable kernel oops for me in vortex_open() during ifconfig.
I had used "-O3 -fomit-frame-pointer -mcpu=pentium" as the
architecture-specific settings for a 586.  This does not happen with
gcc 2.7.2.1.

Unable to handle kernel paging request at virtual address f6003b0d
current->tss.cr3 = 01d36000, 
*pde = 00000000
Oops: 0000
CPU:    0
EIP:    0010:[<001a7cf6>]
EFLAGS: 00010246
eax: 360036c0   ebx: 01020010   ecx: 00000000   edx: 00006000
esi: 001da00b   edi: 01f36f49   ebp: 00001002   esp: 01f36ed4
ds: 0018   es: 0018   fs: 002b   gs: 002b   ss: 0018
Process ifconfig (pid: 42, process nr: 9, stackpage=01f36000)
Stack: 001f68d0 001da00b 01f36f49 00001002 01fa43d8 01d672e8 00000001 01f36f00 
       40008000 00000000 bffffd48 01d47414 08003e6a 00008914 00124a05 0010a010 
       00000000 360036c0 00006000 0013cdc6 001f68d0 bffffd48 01d47414 08003e6a 
Call Trace: [<00124a05>] [<0010a010>] [<0013cdc6>] [<0013d687>] [<001544d6>] [<0013a7c1>] [<0012d0f9>] 
       [<0010a8d5>] 
Code: 8a 88 4d 04 00 00 83 e1 07 83 f9 07 74 6c 83 3d 90 6c 1f 00 

Using `../System.map' to map addresses to symbols.

>>EIP: 1a7cf6 <vortex_open+3a/768>
Trace: 124a05 <getblk+29/470>
Trace: 10a010 <dump_thread+c8/d0>
Trace: 13cdc6 <dev_ifsioc+2aa/664>
Trace: 13d687 <dev_ioctl+1b7/1f8>
Trace: 1544d6 <inet_ioctl+326/354>
Trace: 13a7c1 <sock_ioctl+1d/24>
Trace: 12d0f9 <sys_ioctl+105/114>
Trace: 10a8d5 <system_call+55/80>

Code: 1a7cf6 <vortex_open+3a/768> 
Code: 1a7cf6 <vortex_open+3a/768>  8a 88 4d 04 00 	movb   0x44d(%eax),%cl
Code: 1a7cfb <vortex_open+3f/768>  00 
Code: 1a7cfc <vortex_open+40/768>  83 e1 07       	andl   $0x7,%ecx
Code: 1a7cff <vortex_open+43/768>  83 f9 07       	cmpl   $0x7,%ecx
Code: 1a7d08 <vortex_open+4c/768>  74 6c          	je     1a7d70 <vortex_open+b4/768>
Code: 1a7d0a <vortex_open+4e/768>  83 3d 90 6c 1f 	cmpl   $0x0,0x1f6c90
Code: 1a7d0f <vortex_open+53/768>  00 00 
Code: 1a7d17 <vortex_open+5b/768>  90             	nop    
Code: 1a7d18 <vortex_open+5c/768>  90             	nop    
Code: 1a7d19 <vortex_open+5d/768>  90             	nop    

$ gcc -v
Reading specs from /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/egcs-2.90.23/specs
gcc version egcs-2.90.23 980102 (egcs-1.0.1 release)

Here's a disassembly of the 3c59x.o file, up to the relevant place.

00000bc8 <vortex_open>:
     bc8:	83 ec 3c       	subl   $0x3c,%esp
     bcb:	55             	pushl  %ebp
     bcc:	57             	pushl  %edi
     bcd:	56             	pushl  %esi
     bce:	53             	pushl  %ebx
     bcf:	8b 44 24 50    	movl   0x50(%esp,1),%eax
     bd3:	8b 54 24 50    	movl   0x50(%esp,1),%edx
     bd7:	8b 40 14       	movl   0x14(%eax),%eax
     bda:	89 44 24 48    	movl   %eax,0x48(%esp,1)
     bde:	8b 52 44       	movl   0x44(%edx),%edx
     be1:	8b 4c 24 48    	movl   0x48(%esp,1),%ecx
     be5:	89 54 24 44    	movl   %edx,0x44(%esp,1)
     be9:	83 c1 0e       	addl   $0xe,%ecx
     bec:	b8 03 08 00 00 	movl   $0x803,%eax
     bf1:	89 ca          	movl   %ecx,%edx
     bf3:	66 ef          	outw   %ax,(%dx)
     bf5:	8b 54 24 48    	movl   0x48(%esp,1),%edx
     bf9:	ed             	inl    (%dx),%eax
     bfa:	89 c3          	movl   %eax,%ebx
     bfc:	8b 44 24 44    	movl   0x44(%esp,1),%eax
     c00:	31 c9          	xorl   %ecx,%ecx
     c02:	8a 88 4d 04 00 	movb   0x44d(%eax),%cl
     c07:	00 
     c08:	83 e1 07       	andl   $0x7,%ecx
     c0b:	83 f9 07       	cmpl   $0x7,%ecx
     c0e:	74 6c          	je     c7c <vortex_open+b4>
     c10:	83 3d 14 00 00 	cmpl   $0x1,0x14
[...]

-- 
Thomas Koenig, Thomas.Koenig@ciw.uni-karlsruhe.de, ig25@dkauni2.bitnet.
The joy of engineering is to find a straight line on a double
logarithmic diagram.



More information about the Gcc mailing list