------- Comment #15 from drab at kepler dot fjfi dot cvut dot cz 2006-01-16 03:02 ------- (In reply to comment #13) > This is how the (relevant) thing looks like, when compiled with -O2 > -fomit-frame-pointer. I removed the "static" modifier of the function, since > then it got merged within other functions and didn't get its own instance, but > the failure is still there. > > ------------------------------ > .p2align 4,,15 > .type print_filtered_help, @function > print_filtered_help: > .LFB197: > .loc 1 1290 0 > .LVL93: > pushl %ebp > .LCFI22: > pushl %edi > .LCFI23: > pushl %esi > .LCFI24: > pushl %ebx > .LCFI25: > subl $28, %esp > .LCFI26: > .loc 1 1296 0 > cmpl $536870912, %eax > sete %dl > cmpl $4194304, %eax > .loc 1 1290 0 > movl %eax, 16(%esp) > .loc 1 1296 0 > sete %al > .LVL94: > orb %al, %dl > je .L155 > .loc 1 1299 0 > movl printed.20731, %eax > testl %eax, %eax > je .L211 > movl cl_options_count, %ebx > .L157: > .loc 1 1301 0 > movl printed.20731, %eax > movl %ebx, cl_options_count > .LBB59: > .LBB60: > .file 3 "/usr/include/bits/stdio.h" > .loc 3 94 0 > xorl %esi, %esi > .LVL95: > .LBE60: > .LBE59: > .loc 1 1301 0 > movl %ebx, 8(%esp) > movl $0, 4(%esp) > .LBB61: > .LBB62: > .loc 3 94 0 > xorl %ebx, %ebx > .LBE62: > .LBE61: > .loc 1 1301 0 > movl %eax, (%esp) > call memset
I guess the third parameter isn't set at all! Is it supposed to be %ecx or what is supposed to be the third register parameter of the memset call? Anyway, it should be set to the 'cl_options_count', but you may notice, that 'cl_options_count' resides in %ebx all the time, and just before the call to the 'memset' function there is a 'xorl %ebx, %ebx', which is perhaps correct as it is the second argument of the 'memset' and that should be 0. But the third argument is left totally unset, though random, and though causes the segfault! (I think) > ... > > .L211: > .loc 1 1300 0 > movl cl_options_count, %ebx > movl %ebx, (%esp) > call xmalloc > movl %eax, printed.20731 > jmp .L157 > > ... > ------------------------------ > -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25636