From: Bruno H. <br...@cl...> - 2005-01-12 21:24:39
|
Sam wrote: > >> calls.c: In function `C_subr_posix_crypt': > >> calls.c:241: warning: alloca()ed storage released along with > >> dynamically-sized auto objects > > > > I don't know whether this is harmless. You need to look at the > > assembly code generated by gcc. > > <http://www.podval.org/~sds/clisp/calls.o> Ah, what should I do with a .o file? Show the .s file! (Preferrably without -g and -O2, just with -O, that's the simplest to read.) .globl C_subr_posix_crypt .type C_subr_posix_crypt, @function C_subr_posix_crypt: pushl %ebp movl %esp, %ebp pushl %edi pushl %esi pushl %ebx subl $60, %esp movl STACK, %ebx movl -4(%ebx), %edx movl %ebx, %esi movl %edx, %eax andl $7, %eax cmpl $6, %eax je .L92 .L60: movl %edx, (%esp) call check_string_replacement movl STACK, %ebx movl %eax, %edx .L59: movl %edx, -4(%esi) movl -8(%ebx), %edx movl %edx, %eax andl $7, %eax cmpl $6, %eax je .L93 .L63: movl %edx, (%esp) call check_string_replacement movl %eax, %edx .L62: movl %edx, -8(%ebx) leal -16(%ebp), %eax movl %eax, 8(%esp) leal -20(%ebp), %eax movl %eax, 4(%esp) movl STACK, %eax movl -4(%eax), %eax movl %eax, (%esp) call unpack_string_ro cmpl $symbol_tab_data+6, %eax movl %eax, %ebx je .L94 movsbl 2(%eax),%eax leal -17(%eax), %edx sarl %edx cmpl $2, %edx je .L95 movl -20(%ebp), %ecx leal 30(,%ecx,4), %eax andl $-16, %eax subl %eax, %esp leal 35(%esp), %esi andl $-16, %esi testl %ecx, %ecx jne .L96 .p2align 4,,15 .L68: movl %esp, -32(%ebp) movl %ecx, 8(%esp) movl %esi, 4(%esp) movl object_tab+36, %eax movl %eax, (%esp) call cslen_f movl %eax, %ebx leal 31(%eax), %eax andl $-16, %eax subl %eax, %esp leal 35(%esp), %eax andl $-16, %eax movl %eax, -36(%ebp) movl %ebx, 16(%esp) movl %eax, 12(%esp) movl -20(%ebp), %eax movl %esi, 4(%esp) movl %eax, 8(%esp) movl object_tab+36, %eax movl %eax, (%esp) call cstombs_f movl -36(%ebp), %eax movb $0, (%eax,%ebx) leal -24(%ebp), %eax movl %eax, 8(%esp) leal -28(%ebp), %eax movl %eax, 4(%esp) movl STACK, %eax movl -8(%eax), %eax movl %eax, (%esp) call unpack_string_ro cmpl $symbol_tab_data+6, %eax movl %eax, %ebx je .L97 movsbl 2(%eax),%eax leal -17(%eax), %edx sarl %edx cmpl $2, %edx je .L98 movl -28(%ebp), %ecx leal 30(,%ecx,4), %eax andl $-16, %eax subl %eax, %esp leal 35(%esp), %esi andl $-16, %esi testl %ecx, %ecx je .L82 cmpl $1, %edx je .L99 testl %edx, %edx jne .L85 movl %ecx, 8(%esp) movl %esi, 4(%esp) movl -24(%ebp), %eax addl %eax, %ebx leal 6(%ebx), %eax movl %eax, (%esp) call copy_8bit_32bit movl -28(%ebp), %ecx .L82: movl %esi, -40(%ebp) .L79: movl %ecx, 8(%esp) movl %esp, %edi movl -40(%ebp), %eax movl %eax, 4(%esp) movl object_tab+36, %eax movl %eax, (%esp) call cslen_f movl %eax, %esi leal 31(%eax), %eax andl $-16, %eax subl %eax, %esp leal 35(%esp), %ebx andl $-16, %ebx movl %esi, 16(%esp) movl %ebx, 12(%esp) movl -28(%ebp), %eax movl %eax, 8(%esp) movl -40(%ebp), %eax movl %eax, 4(%esp) movl object_tab+36, %eax movl %eax, (%esp) call cstombs_f movb $0, (%ebx,%esi) movl -36(%ebp), %eax movl %ebx, (%esp) movl %eax, 4(%esp) call crypt testl %eax, %eax movl %eax, %edx movl %edi, %esp movl -32(%ebp), %esp je .L100 movl object_tab+36, %eax movl %edx, (%esp) movl $1, %esi movl %eax, 4(%esp) call asciz_to_string subl $8, STACK movl %eax, mv_space movl %esi, mv_count leal -12(%ebp), %esp popl %ebx popl %esi popl %edi popl %ebp ret .p2align 4,,7 .L96: cmpl $1, %edx je .L101 testl %edx, %edx jne .L85 movl %ecx, 8(%esp) movl %esi, 4(%esp) movl -16(%ebp), %eax addl %eax, %ebx leal 6(%ebx), %eax movl %eax, (%esp) call copy_8bit_32bit movl -20(%ebp), %ecx jmp .L68 .p2align 4,,7 .L93: movzbl 2(%edx), %eax subb $17, %al cmpb $6, %al jbe .L62 jmp .L63 .p2align 4,,7 .L92: movzbl 2(%edx), %eax subb $17, %al cmpb $6, %al jbe .L59 jmp .L60 .p2align 4,,7 .L95: movl -16(%ebp), %eax movl -20(%ebp), %ecx leal 6(%ebx,%eax,4), %esi jmp .L68 .p2align 4,,7 .L98: movl -24(%ebp), %eax movl -28(%ebp), %ecx leal 6(%ebx,%eax,4), %eax movl %eax, -40(%ebp) jmp .L79 .p2align 4,,7 .L94: movl -20(%ebp), %ecx xorl %esi, %esi testl %ecx, %ecx je .L68 call fehler_nilarray_retrieve .p2align 4,,7 .L97: movl $0, -40(%ebp) movl -28(%ebp), %ecx testl %ecx, %ecx je .L79 call fehler_nilarray_retrieve .p2align 4,,7 .L101: movl %ecx, 8(%esp) movl %esi, 4(%esp) movl -16(%ebp), %eax leal 6(%ebx,%eax,2), %eax movl %eax, (%esp) call copy_16bit_32bit movl -20(%ebp), %ecx jmp .L68 .L99: movl %ecx, 8(%esp) movl %esi, 4(%esp) movl -24(%ebp), %eax leal 6(%ebx,%eax,2), %eax movl %eax, (%esp) call copy_16bit_32bit movl -28(%ebp), %ecx jmp .L82 .L100: call OS_error .L85: movl $.LC262, (%esp) movl $244, %edi movl %edi, 4(%esp) call fehler_notreached .size C_subr_posix_crypt, .-C_subr_posix_crypt extern Values C_subr_posix_crypt (void) { char *result; ((STACK[-1-(sintP)(0)])) = check_string(((STACK[-1-(sintP)(0)]))); ((STACK[-1-(sintP)(1)])) = check_string(((STACK[-1-(sintP)(1)]))); do { uintL salt_len; uintL salt_offset; object salt_string = unpack_string_ro(((STACK[-1-(sintP)(0)])),&salt_len,&salt_offset); const chart* ptr1; if ((((salt_string) == (((object)((UBYTE*)(&symbol_tab_data.S_nil)+(2UL))))))) { if ((salt_len) > 0) fehler_nilarray_retrieve(); ptr1= ((void *)0); } else if (((((sintB)((((Sstring)((oint)(salt_string)-2UL)))->tfl & 0xFF)) - 17) >> 1) == 2) { ptr1= (const chart*) &((S32string)((oint)(salt_string)-2))->data[salt_offset]; } else { chart* _unpacked_ = (chart*)__builtin_alloca ((salt_len)*sizeof(chart)); if ((salt_len) > 0) { if (((((sintB)((((Sstring)((oint)(salt_string)-2UL)))->tfl & 0xFF)) - 17) >> 1) == 1) copy_16bit_32bit(&((S16string)((oint)(salt_string)-2))->data[salt_offset],(cint32*)_unpacked_,salt_len); else if (((((sintB)((((Sstring)((oint)(salt_string)-2UL)))->tfl & 0xFF)) - 17) >> 1) == 0) copy_8bit_32bit(&((S8string)((oint)(salt_string)-2))->data[salt_offset],(cint32*)_unpacked_,salt_len); else fehler_notreached("calls.c",244); } ptr1= (const chart*) _unpacked_; }; { uintL salt_bytelen = cslen_f((object_tab.misc_encoding),ptr1,salt_len); uintB salt_data[salt_bytelen+1]; cstombs_f((object_tab.misc_encoding),ptr1,salt_len,&salt_data[0],salt_bytelen); salt_data[salt_bytelen] = 0; { char* salt = (char*) &salt_data[0]; { do { uintL key_len; uintL key_offset; object key_string = unpack_string_ro(((STACK[-1-(sintP)(1)])),&key_len,&key_offset); const chart* ptr1; if ((((key_string) == (((object)((UBYTE*)(&symbol_tab_data.S_nil)+(2UL))))))) { if ((key_len) > 0) fehler_nilarray_retrieve(); ptr1= ((void *)0); } else if (((((sintB)((((Sstring)((oint)(key_string)-2UL)))->tfl & 0xFF)) - 17) >> 1) == 2) { ptr1= (const chart*) &((S32string)((oint)(key_string)-2))->data[key_offset]; } else { chart* _unpacked_ = (chart*)__builtin_alloca ((key_len)*sizeof(chart)); if ((key_len) > 0) { if (((((sintB)((((Sstring)((oint)(key_string)-2UL)))->tfl & 0xFF)) - 17) >> 1) == 1) copy_16bit_32bit(&((S16string)((oint)(key_string)-2))->data[key_offset],(cint32*)_unpacked_,key_len); else if (((((sintB)((((Sstring)((oint)(key_string)-2UL)))->tfl & 0xFF)) - 17) >> 1) == 0) copy_8bit_32bit(&((S8string)((oint)(key_string)-2))->data[key_offset],(cint32*)_unpacked_,key_len); else fehler_notreached("calls.c",244); } ptr1= (const chart*) _unpacked_; }; { uintL key_bytelen = cslen_f((object_tab.misc_encoding),ptr1,key_len); uintB key_data[key_bytelen+1]; cstombs_f((object_tab.misc_encoding),ptr1,key_len,&key_data[0],key_bytelen); key_data[key_bytelen] = 0; { char* key = (char*) &key_data[0]; { ; result = crypt(key,salt); ; } } ; } } while(0); } } ; } } while(0); There is nothing wrong with two alloca() calls or the two array variables here. The warning doesn't occur with gcc-3.4.3. In fact the patch http://gcc.gnu.org/ml/gcc-patches/2004-02/msg02092.html is not contained in gcc-3.4.3. Bruno |