This is the mail archive of the gcc-bugs@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]

[Bug inline-asm/24761] Missing register load before inline asm in templated function causes SIGSEGV



------- Comment #2 from krzysiek-gcc dot gnu dot org at lichota dot net  2005-11-09 19:49 -------
Created an attachment (id=10195)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10195&action=view)
Assembler code generated from testcase

This is code generated from testcase.
In first instantiation eax register is loaded before inline asm starts:
        .loc 1 25 0
        movl    -16(%ebp), %eax
        addl    -20(%ebp), %eax
        sall    $2, %eax
        addl    8(%ebp), %eax
        movl    %eax, -8(%ebp)
        .loc 1 41 0
        movl    -16(%ebp), %eax
        addl    -24(%ebp), %eax
        sall    $2, %eax
        movl    %eax, %edx
        addl    -12(%ebp), %edx
        movl    -8(%ebp), %eax
#APP
               movq   (%edx), %mm0   ;

In the second instantiation, eax is not loaded:
        .loc 1 25 0
        movl    -16(%ebp), %eax
        addl    -20(%ebp), %eax
        sall    $2, %eax
        addl    8(%ebp), %eax
        movl    %eax, -8(%ebp)
        .loc 1 41 0
        movl    -16(%ebp), %eax
        addl    -24(%ebp), %eax
        sall    $2, %eax
        movl    %eax, %edx
        addl    -12(%ebp), %edx
#APP
               movq   (%edx), %mm0   ;

Then in line:
       pxor   (%eax), %mm0   ;

eax is dereferenced and segfault occurs.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24761


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