Branch condition problems
Hi,
I can't reproduce the problem with attached test program. Also the generated ops look just fine:
IN:
0x00010074: sethi %hi(0x20000), %g3 0x00010078: or %g3, 0xa0, %g3 ! 0x200a0 0x0001007c: mov -1, %g1 0x00010080: mov -1, %g2 0x00010084: tst %g0 0x00010088: bne 0x10094 0x0001008c: std %g1, [ %g3 ]
OP:0x0000: movl_T0_im 0x200000x0001: movl_g3_T00x0002: movl_T0_g30x0003: movl_T1_sim 0xa00x0004: or_T1_T00x0005: movl_g3_T00x0006: movl_T1_sim 0xffffffff 0x0007: movl_g1_T10x0008: movl_T1_sim 0xffffffff 0x0009: movl_g2_T10x000a: movl_T0_im 0x00x000b: movl_T1_im 0x00x000c: or_T1_T00x000d: logic_T0_cc
Set T2:0x000e: eval_bne
First part of std:0x000f: movl_T0_g30x0010: movl_T1_g1flush_T2 here:0x0011: jz_T2_label 0x00x0012: movl_npc_im 0x100940x0013: jmp_label 0x10x0014: movl_npc_im 0x10090
Now reuse T2, rest of std:0x0015: movl_T2_g20x0016: std_raw0x0017: next_insn0x0018: movl_T0_00x0019: exit_tb0x001a: end
--------------
IN:
Branch not taken (OK)
0x00010090: nop 0x00010094: mov 1, %g1 ! 0x1 0x00010098: ta 0x10
OP:0x0000: movl_T1_sim 0x10x0001: movl_g1_T10x0002: movl_T0_im 0x00x0003: movl_T1_sim 0x100x0004: add_T1_T00x0005: jmp_im 0x100980x0006: movl_npc_im 0x1009c0x0007: trap_T00x0008: next_insn0x0009: movl_T0_00x000a: exit_tb0x000b: end
Can you describe how to reproduce the bug?
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
Quoted 5 lines · Blue Swirl
Hi,
I can't reproduce the problem with attached test program. Also the generated ops look just fine:
[snip]
Quoted 3 lines
Can you describe how to reproduce the bug?
Well I also have difficulties to reproduce it with a simple program. I have detected it while trying to build binutils on a Debian unstable distribution running in QEMU.
The problem occurs when running the configure script of libiberty as a normal user using fakeroot, using bash as /bin/sh. The last character of some of the $LINENO variables is wrongly computed. It is computed using the modulo function from gcc (moddi3) called from fmtumax() called from itos(). In some very rare conditions (I don't know all of them) a branch is falsely taken which result in a wrong sign. When added to 0x30, it results in a wrong character. Some of them like ) or ( are triggering an error message. I have been able to track the bug up to the branch instruction followed by a std instruction by directly editing the assembly code of bash to cancel some tests.
Note that you need to use fakeroot to see the problem, and also that using gdb workaround the bug. Rebuilding bash with -O0 or -O1 workarounds the problem. Using -g helps to get the function names along with the assembly code when using objdump
To reproduce it, the best way is to use a Debian unstable distribution running in QEMU, at run (I can provide an image if you need one):
apt-get install binutils
cd binutils-2.17-3/libiberty
fakeroot ./configure
You will see that some tests fail with a strange error message from bash. This error is fixed by the patch I posted or by the one you posted.
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net