This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug inline-asm/24761] Missing register load before inline asm in templated function causes SIGSEGV
- From: "krzysiek-gcc dot gnu dot org at lichota dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Nov 2005 19:49:58 -0000
- Subject: [Bug inline-asm/24761] Missing register load before inline asm in templated function causes SIGSEGV
- References: <bug-24761-11690@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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