On Sat, Apr 27, 2013 at 3:38 PM, Sergey Vlasov <v...@altlinux.ru> wrote: > On Sat, Apr 27, 2013 at 02:09:22AM -0300, Luiz Angelo Daros de Luca wrote: >> The usage of sign-extension might be cause. The problem is that all these >> variables are sector_t, which as far as I know, is a u64. >> Even if it was using signed variable, all of them are 64bit and using >> values much lower that 2^63. >> >> As mips is not a 64-bit processor, the compiler must do it by parts. So, >> where is this problem from? Compiler? Kernel? > > Seems that at least gcc-4.6-linaro from AA (mips-openwrt-linux-gcc > (Linaro GCC 4.6-2012.02) 4.6.3 20120201 (prerelease), > PKG_MD5SUM:=2b7887846f8e5ac1ca58fe4dfaabf5a6) is buggy. Here is a > self-contained test case:
(snip) > The "madd $3,$2" command here is incorrect - it performs sign > extension of its arguments; it should be "maddu $3,$2". I came to the same conclusion after looking at the assembly of the function. Using your testcase I tested the available gcc versions. It looks the bug is already in vanilla gcc up to 4.7.2, but is fixed in 4.8.0. At least I see a maddu there instead of a addu. I did not test 4.7.3. Now the next step will finding the appropriate changeset and backport it to 4.6.x/4.7.x. Jonas _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel