https://bugs.kde.org/show_bug.cgi?id=468575
--- Comment #52 from Mark Wielaard <m...@klomp.org> --- On a fedora system I saw an issue with testcases that invoked bash, and also when running bash itself under valgrind. It does an And1(0:I1,t6)) So an AND against False [0], which is odd in itself, since that should really have been optimized out as always being False. But the real issue is not handling Ity_I1 (constants) in the backend. ==== SB 4680 (evchecks 98254) [tid 1] 0x1b708a fmtulong+150 /usr/bin/bash+0xaf08a ------------------------ Front end ------------------------ (riscv64) 0x1B708A: c.li a1, 10 ------ IMark(0x1B708A, 2, 0) ------ PUT(104) = 0xA:I64 PUT(272) = 0x1B708C:I64 (riscv64) 0x1B708C: c.andi a4, 0x2 ------ IMark(0x1B708C, 2, 0) ------ PUT(128) = And64(GET:I64(128),0x2:I64) PUT(272) = 0x1B708E:I64 (riscv64) 0x1B708E: beq a4, zero, 0x1B726C ------ IMark(0x1B708E, 4, 0) ------ if (CmpEQ64(GET:I64(128),GET:I64(16))) { PUT(272) = 0x1B726C:I64; exit-Boring } PUT(272) = 0x1B7092:I64 PUT(272) = GET:I64(272); exit-Boring IRSB { t0:I64 t1:I64 t2:I1 t3:I64 t4:I64 t5:I64 IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp ------ IMark(0x1B708A, 2, 0) ------ PUT(104) = 0xA:I64 PUT(272) = 0x1B708C:I64 ------ IMark(0x1B708C, 2, 0) ------ t1 = GET:I64(128) t0 = And64(t1,0x2:I64) PUT(128) = t0 PUT(272) = 0x1B708E:I64 ------ IMark(0x1B708E, 4, 0) ------ t4 = GET:I64(16) t2 = CmpEQ64(t0,t4) if (t2) { PUT(272) = 0x1B726C:I64; exit-Boring } PUT(272) = 0x1B7092:I64; exit-Boring } BlockEnd: Cond{condSX=t2, deltaSX=482, deltaFT=8} -+-+ (ext# 1) Considering cbranch to SX=0x1B726C FT=0x1B7092 -+-+ -+-+ SPEC side exit -+-+ (riscv64) 0x1B726C: c.mv a0, a3 ------ IMark(0x1B726C, 2, 0) ------ PUT(96) = GET:I64(120) PUT(272) = 0x1B726E:I64 (riscv64) 0x1B726E: c.j 0x1B70C8 ------ IMark(0x1B726E, 2, 0) ------ PUT(272) = 0x1B70C8:I64 PUT(272) = GET:I64(272); exit-Boring IRSB { t0:I64 t1:I64 ------ IMark(0x1B726C, 2, 0) ------ t0 = GET:I64(120) PUT(96) = t0 PUT(272) = 0x1B726E:I64 ------ IMark(0x1B726E, 2, 0) ------ PUT(272) = 0x1B70C8:I64; exit-Boring } BlockEnd: Uncond{delta=62} -+-+ SPEC fall through -+-+ (riscv64) 0x1B7092: c.li a5, 10 ------ IMark(0x1B7092, 2, 0) ------ PUT(136) = 0xA:I64 PUT(272) = 0x1B7094:I64 (riscv64) 0x1B7094: beq a1, a5, 0x1B726C ------ IMark(0x1B7094, 4, 0) ------ if (CmpEQ64(GET:I64(104),GET:I64(136))) { PUT(272) = 0x1B726C:I64; exit-Boring } PUT(272) = 0x1B7098:I64 PUT(272) = GET:I64(272); exit-Boring IRSB { t0:I1 t1:I64 t2:I64 t3:I64 ------ IMark(0x1B7092, 2, 0) ------ PUT(136) = 0xA:I64 PUT(272) = 0x1B7094:I64 ------ IMark(0x1B7094, 4, 0) ------ t1 = GET:I64(104) t0 = CmpEQ64(t1,0xA:I64) if (t0) { PUT(272) = 0x1B726C:I64; exit-Boring } PUT(272) = 0x1B7098:I64; exit-Boring } BlockEnd: Cond{condSX=t0, deltaSX=482, deltaFT=14} -+-+ After normalisation (idiom=3) -+-+ -+-+ IRSB -+-+ IRSB { t0:I64 t1:I64 t2:I1 t3:I64 t4:I64 t5:I64 t6:I1 IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp ------ IMark(0x1B708A, 2, 0) ------ PUT(104) = 0xA:I64 PUT(272) = 0x1B708C:I64 ------ IMark(0x1B708C, 2, 0) ------ t1 = GET:I64(128) t0 = And64(t1,0x2:I64) PUT(128) = t0 PUT(272) = 0x1B708E:I64 ------ IMark(0x1B708E, 4, 0) ------ t4 = GET:I64(16) t2 = CmpEQ64(t0,t4) t6 = Not1(t2) if (t6) { PUT(272) = 0x1B7092:I64; exit-Boring } PUT(272) = 0x1B726C:I64; exit-Boring } Cond{condSX=t6, deltaSX=8, deltaFT=482} -+-+ SX -+-+ IRSB { t0:I1 t1:I64 t2:I64 t3:I64 t4:I1 ------ IMark(0x1B7092, 2, 0) ------ PUT(136) = 0xA:I64 PUT(272) = 0x1B7094:I64 ------ IMark(0x1B7094, 4, 0) ------ t1 = GET:I64(104) t0 = CmpEQ64(t1,0xA:I64) t4 = Not1(t0) if (t4) { PUT(272) = 0x1B7098:I64; exit-Boring } PUT(272) = 0x1B726C:I64; exit-Boring } Cond{condSX=t4, deltaSX=14, deltaFT=482} -+-+ DOING &&-TRANSFORM -+-+ -+-+ FINAL RESULT -+-+ IRSB { t0:I64 t1:I64 t2:I1 t3:I64 t4:I64 t5:I64 t6:I1 t7:I1 t8:I64 t9:I64 t10:I64 t11:I1 t12:I64 t13:I64 t14:I64 t15:I64 t16:I1 IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp IR-NoOp ------ IMark(0x1B708A, 2, 0) ------ PUT(104) = 0xA:I64 PUT(272) = 0x1B708C:I64 ------ IMark(0x1B708C, 2, 0) ------ t1 = GET:I64(128) t0 = And64(t1,0x2:I64) PUT(128) = t0 PUT(272) = 0x1B708E:I64 ------ IMark(0x1B708E, 4, 0) ------ t4 = GET:I64(16) t2 = CmpEQ64(t0,t4) t6 = Not1(t2) ------ IMark(0x1B7092, 2, 0) ------ t12 = GET:I64(136) t13 = ITE(t6,0xA:I64,t12) PUT(136) = t13 t14 = GET:I64(272) t15 = ITE(t6,0x1B7094:I64,t14) PUT(272) = t15 ------ IMark(0x1B7094, 4, 0) ------ t8 = GET:I64(104) t7 = CmpEQ64(t8,0xA:I64) t11 = Not1(t7) t16 = And1(t11,t6) if (t16) { PUT(272) = 0x1B7098:I64; exit-Boring } PUT(272) = 0x1B726C:I64; exit-Boring } GuestBytes 1B708A 14 A9 45 09 8B 63 0F 07 1C A9 47 63 8C F5 1C 0013C80E ------------------------ Instruction selection ------------------------ (evCheck) lw t0, -2040(s0); c.addiw t0, -1; sw t0, -2040(s0); bge t0, zero, 1f; ld t0, -2048(s0); c.jr 0(t0); 1: -- ------ IMark(0x1B708A, 2, 0) ------ -- PUT(104) = 0xA:I64 li %vR17, 0xA sd %vR17, -1944(s0) -- ------ IMark(0x1B708C, 2, 0) ------ -- t0 = And64(GET:I64(128),0x2:I64) ld %vR19, -1920(s0) li %vR20, 0x2 and %vR18, %vR19, %vR20 mv %vR0, %vR18 -- PUT(128) = t0 sd %vR0, -1920(s0) -- ------ IMark(0x1B708E, 4, 0) ------ -- t6 = Not1(CmpEQ64(t0,GET:I64(16))) ld %vR23, -2032(s0) sub %vR22, %vR0, %vR23 sltiu %vR24, %vR22, 1 sltiu %vR21, %vR24, 1 mv %vR6, %vR21 -- ------ IMark(0x1B7092, 2, 0) ------ -- PUT(136) = ITE(t6,0xA:I64,GET:I64(136)) li %vR26, 0xA ld %vR27, -1912(s0) (CSEL) beq %vR6, zero, 1f; c.mv %vR25, %vR26; c.j 2f; 1: c.mv %vR25, %vR27; 2: sd %vR25, -1912(s0) -- PUT(272) = ITE(t6,0x1B7094:I64,0x1B708E:I64) li %vR29, 0x1B7094 li %vR30, 0x1B708E (CSEL) beq %vR6, zero, 1f; c.mv %vR28, %vR29; c.j 2f; 1: c.mv %vR28, %vR30; 2: sd %vR28, -1776(s0) -- ------ IMark(0x1B7094, 4, 0) ------ -- if (And1(0:I1,t6)) { PUT(272) = 0x1B7098:I64; exit-Boring } vex: the `impossible' happened: iselIntExpr_R(riscv64) vex storage: T total 136618504 bytes allocated vex storage: P total 0 bytes allocated valgrind: the 'impossible' happened: LibVEX called failure_exit(). host stacktrace: ==2344425== at 0x5802029C: show_sched_status_wrk (m_libcassert.c:426) ==2344425== by 0x5802035B: report_and_quit (m_libcassert.c:497) ==2344425== by 0x5802049B: vgPlain_core_panic_at (m_libcassert.c:573) ==2344425== by 0x580204B7: vgPlain_core_panic (m_libcassert.c:583) ==2344425== by 0x58030861: failure_exit (m_translate.c:761) ==2344425== by 0x580C9B89: vpanic (main_util.c:253) ==2344425== by 0x580F11A3: iselIntExpr_R (host_riscv64_isel.c:1192) ==2344425== by 0x580F1B83: iselIntExpr_R (host_riscv64_isel.c:716) ==2344425== by 0x580F36E7: iselSB_RISCV64 (host_riscv64_isel.c:1842) ==2344425== by 0x580C824B: LibVEX_Translate (main_main.c:1151) ==2344425== by 0x58032685: vgPlain_translate (m_translate.c:1835) ==2344425== by 0x5800D70F: handle_chain_me (scheduler.c:1172) ==2344425== by 0x5800F9A1: vgPlain_scheduler (scheduler.c:1568) ==2344425== by 0x58063A7D: run_a_thread_NORETURN (syswrap-linux.c:102) sched status: running_tid=1 Thread 1: status = VgTs_Runnable (lwpid 2344425) ==2344425== at 0x1B708A: fmtulong (in /usr/bin/bash) ==2344425== by 0x156961: set_ppid (in /usr/bin/bash) ==2344425== by 0x156B73: initialize_shell_variables (in /usr/bin/bash) ==2344425== by 0x13AF5F: ??? (in /usr/bin/bash) ==2344425== by 0x138767: main (in /usr/bin/bash) client stack range: [0x1FFEFFD000 0x1FFF000FFF] client SP: 0x1FFEFFF6F0 valgrind stack range: [0x10029CF000 0x1002ACEFFF] top usage: 12464 of 1048576 -- You are receiving this mail because: You are watching all bug changes.