NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-mac68k/51783 fsck crashes with a "floating point excepton" error message.



The following reply was made to PR port-mac68k/51783; it has been noted by GNATS.

From: Michael van Elst <mlelstv%serpens.de@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: port-mac68k/51783 fsck crashes with a "floating point excepton"
 error message.
Date: Sun, 12 Feb 2017 10:22:27 +0100

 It's a compiler bug. gcc translates the following loop
 
 	for (sizepb = sblock->fs_bsize, i = 0; i < ilevel; i++)
 		sizepb *= FFS_NINDIR(sblock);
 
 into
 
    0x6aa0 <iblock+124>: movel %a0@(48),%d3         sblock->fs_bsize
    0x6aa4 <iblock+128>: smi %d2
    0x6aa6 <iblock+130>: extbl %d2
    ...
 
    0x6ab8 <iblock+148>: movel %a0@(116),%d6        sblock->fs_nindir
    0x6abc <iblock+152>: movel %d6,%d1
    0x6abe <iblock+154>: smi %d0
    0x6ac0 <iblock+156>: extbl %d0
 
    0x6ac2 <iblock+158>: subal %a1,%a1              i = 0
 
 d0:d1 is sblock->fs_nindir
 d2:d3 is sizepb
 
 res = ((mul32(d1,d2) + mul32(d0,d3)) << 32) + mul64(d1,d3)
 
    0x6ac4 <iblock+160>: mulsl %d1,%d2              
    0x6ac8 <iblock+164>: mulsl %d0,%d3 
    0x6acc <iblock+168>: moveal %d2,%a0
    0x6ace <iblock+170>: addal %d3,%a0              
 
 computed mul32(d1,d2) + mul32(d0,d3), however d2 and d3 are now trashed
 
    0x6ad0 <iblock+172>: mulul %d1,%d2,%d3
 
 computed mul64(d1,d3) with result in d2:d3, however d3 was trashed before
 
    0x6ad4 <iblock+176>: addl %a0,%d2
 
 computed added first intermediate result to high longword
 
    0x6ad6 <iblock+178>: addql #1,%a1               i++
    0x6ad8 <iblock+180>: cmpal %fp@(-2084),%a1      i != ilevel
    0x6adc <iblock+184>: bnes 0x6ac4 <iblock+160>
 
 
 
 -- 
                                 Michael van Elst
 Internet: mlelstv%serpens.de@localhost
                                 "A potential Snark may lurk in every tree."
 


Home | Main Index | Thread Index | Old Index