reassign 130394 gcc-2.95 severity 130394 important forwarded 130394 [EMAIL PROTECTED] tags 130394 + patch tags 130394 + upstream tags 130394 + fixed retitle 130394 [PR 5700] [ARM; fixed in 3.0] bug in __umodsi3 thanks
The reason this one didn't show up with a cross-compiler is that the bug is in the division support routine itself, rather than the compiler proper. I haven't tested it yet, but I suspect this patch may fix the problem. 2000-08-22 Nick Clifton <[EMAIL PROTECTED]> * config/arm/lib1funcs.asm (__umodsi3): Before performing any restorative additions, test for bottom bits of IP being set, rather than relying upon the RORs not matching. (__modsi3): Ditto. Index: lib1funcs.asm =================================================================== RCS file: /cvs/gcc/gcc/gcc/config/arm/lib1funcs.asm,v retrieving revision 1.7 diff -u -r1.7 lib1funcs.asm --- lib1funcs.asm 1999/04/07 13:53:02 1.7 +++ lib1funcs.asm 2002/02/15 14:17:36 @@ -215,6 +215,13 @@ @ then none of the below will match, since the bit in ip will not be @ in the bottom nibble. ands overdone, overdone, #0xe0000000 + @ If we terminated early, because dividend became zero, then the + @ bit in ip will not be in the bottom nibble, and we should not + @ perform the additions below. We must test for this though + @ (rather relying upon the TSTs to prevent the additions) since + @ the bit in ip could be in the top two bits which might then match + @ with one of the smaller RORs. + tstne ip, #0x7 RETc(eq) pc, lr @ No fixups needed tst overdone, ip, ror #3 addne dividend, dividend, divisor, lsr #3 @@ -397,6 +404,13 @@ @ then none of the below will match, since the bit in ip will not be @ in the bottom nibble. ands overdone, overdone, #0xe0000000 + @ If we terminated early, because dividend became zero, then the + @ bit in ip will not be in the bottom nibble, and we should not + @ perform the additions below. We must test for this though + @ (rather relying upon the TSTs to prevent the additions) since + @ the bit in ip could be in the top two bits which might then match + @ with one of the smaller RORs. + tstne ip, #0x7 beq Lgot_result tst overdone, ip, ror #3 addne dividend, dividend, divisor, lsr #3