Alexander Chemeris
2007-Dec-12 15:05 UTC
[Speex-dev] Speex crashing on ARM with assembler optimization enabled.
On 12/13/07, Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> wrote:> Did you test what happens if you only enable arm4 assembly?Sure. I tested with "--enable-arm4-asm" and there was no difference.> Also, if you can do some investigation, it would be useful to check what bit > of assembly is causing the crash. Can you disable one at a time and check?ok. I'll try binary search, disabling optimizations. Here is disasm of segfault point. Probably it may be helpful. (gdb) bt #0 0x40030334 in open_loop_nbest_pitch () from ./libspeex.so.1 #1 0x400313cc in pitch_search_3tap () from ./libspeex.so.1 #2 0x4002bec0 in nb_encode () from ./libspeex.so.1 #3 0x40036c84 in speex_encode_int () from ./libspeex.so.1 #4 0x00008d68 in main () (gdb) disassemble Dump of assembler code for function open_loop_nbest_pitch: ... skipped... 0x40030300 <open_loop_nbest_pitch+620>: add r0, r3, r8 0x40030304 <open_loop_nbest_pitch+624>: ldrsh r3, [r0] 0x40030308 <open_loop_nbest_pitch+628>: mov r3, r3, lsl #1 0x4003030c <open_loop_nbest_pitch+632>: strh r3, [r0], #2 0x40030310 <open_loop_nbest_pitch+636>: add r6, r6, #1 ; 0x1 0x40030314 <open_loop_nbest_pitch+640>: cmp r6, r7 0x40030318 <open_loop_nbest_pitch+644>: bne 0x40030304 <open_loop_nbest_pitch+624> 0x4003031c <open_loop_nbest_pitch+648>: ldr r3, [r11, #-92] 0x40030320 <open_loop_nbest_pitch+652>: cmp r9, r3 0x40030324 <open_loop_nbest_pitch+656>: blt 0x40030474 <open_loop_nbest_pitch+992> 0x40030328 <open_loop_nbest_pitch+660>: mov r6, r3 0x4003032c <open_loop_nbest_pitch+664>: mov r7, #0 ; 0x0 0x40030330 <open_loop_nbest_pitch+668>: ldr lr, [r11, #-84] 0x40030334 <open_loop_nbest_pitch+672>: ldrh r3, [r7, lr] 0x40030338 <open_loop_nbest_pitch+676>: smulbb r3, r3, r3 0x4003033c <open_loop_nbest_pitch+680>: mov r3, r3, lsl #16 0x40030340 <open_loop_nbest_pitch+684>: mov r12, r3, lsr #16 0x40030344 <open_loop_nbest_pitch+688>: ldr r3, [r4, r10, lsl #2] 0x40030348 <open_loop_nbest_pitch+692>: smulbb r1, r12, r3 0x4003034c <open_loop_nbest_pitch+696>: ldr r2, [r11, #-80] 0x40030350 <open_loop_nbest_pitch+700>: ldrh r0, [r7, r2] 0x40030354 <open_loop_nbest_pitch+704>: ldr r2, [r5, r10, lsl #2] 0x40030358 <open_loop_nbest_pitch+708>: add r3, r0, #1 ; 0x1 0x4003035c <open_loop_nbest_pitch+712>: smulbb lr, r2, r3 0x40030360 <open_loop_nbest_pitch+716>: cmp r1, lr 0x40030364 <open_loop_nbest_pitch+720>: ble 0x40030464 <open_loop_nbest_pitch+976> (gdb) info registers r0 0x4554 17748 r1 0x0 0 r2 0x38a1 14497 r3 0x4555 17749 r4 0xbec831ec 3200791020 r5 0xbec831f4 3200791028 r6 0xae84beb2 2927935154 r7 0xc7c 3196 r8 0x38a1 14497 r9 0x50 80 r10 0x0 0 r11 0xbec83464 3200791652 r12 0x0 0 sp 0xbec831e4 0xbec831e4 lr 0xbec83384 3200791428 pc 0x40030334 0x40030334 <open_loop_nbest_pitch+672> fps 0x0 0 cpsr 0x10 16 I'm not very familiar with gdb, so excuse me if I'm doing something wrong with it. gdb is not very friendly to newcommers. :) -- Regards, Alexander Chemeris. SIPez LLC. SIP VoIP, IM and Presence Consulting http://www.SIPez.com tel: +1 (617) 273-4000
Alexander Chemeris
2007-Dec-12 15:38 UTC
[Speex-dev] Speex crashing on ARM with assembler optimization enabled.
Ok, if I comment out inclusion of "filters_arm4.h" (or comment out its only overridden function - normalize16()) it works fine. Also it works fine if I use -O0 for compilation. Specifying -O1 or -O2 lead to segfault (if "filters_arm4.h" is included, sure). -- Regards, Alexander Chemeris. SIPez LLC. SIP VoIP, IM and Presence Consulting http://www.SIPez.com tel: +1 (617) 273-4000
Jean-Marc Valin
2007-Dec-12 15:45 UTC
[Speex-dev] Speex crashing on ARM with assembler optimization enabled.
Alexander Chemeris a ?crit :> Ok, if I comment out inclusion of "filters_arm4.h" (or comment out its > only overridden function - normalize16()) it works fine. > > Also it works fine if I use -O0 for compilation. Specifying -O1 or -O2 lead > to segfault (if "filters_arm4.h" is included, sure).OK, so either I screwed up the alignment/constraints in the assembly or you've hit a compiler bug. The former is far more probable, but the latter has happened in the past. Jean-Marc