This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Integer overflow in operator new


2007/4/9, J.C. Pizarro <jcpiza@gmail.com> wrote:

_Z29__allocate_array_of_RossRidgejjj: [ gcc v3.4.6 : 9 instructions ] movl 4(%esp), %edx cmpl 12(%esp), %edx # comparing and ?????? i lose me movl 8(%esp), %eax orl $-1, %eax imull %edx, %eax # signed multiply!!! 1 bit signed + unsigned 31x31!!! pushl %eax call _Znaj popl %edx ret

_Z29__allocate_array_of_RossRidgejjj:
[ gcc 4.1.3 20070326 (prerelease) : 8 instructions ]
        movl    4(%esp), %eax
        orl     $-1, %ecx
        cmpl    12(%esp), %eax   # comparing and ?????? i lose me
        movl    8(%esp), %edx
        movl    %edx, %ecx
        imull   %eax, %ecx   # signed multiply!!! 1 bit signed + unsigned 31x31!!!
        movl    %ecx, 4(%esp)
        jmp     _Znaj

_Z29__allocate_array_of_JCPizarrojjj:
[ gcc 4.1.3 20070326 (prerelease) and gcc 3.4.6 : 7 instructions ]
        movl    4(%esp), %edx
        cmpl    12(%esp), %edx   # comparing and ?????? i lose me
        movl    8(%esp), %eax
        movl    $-1, 4(%esp)
        imull   %edx, %eax   # signed multiply!!! 1 bit signed + unsigned 31x31!!!
        movl    %eax, 4(%esp)
        jmp     _Znaj

-----------------------------------------------------------------------------

J.C. Pizarro


I don't see a conditional jump or a test of the zero flag. Am i confuse?


The multiply is signed. It is need more researching a little bit.

Attachment: allocate_array_april2007.tar.gz
Description: GNU Zip compressed data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]