[Bug c++/35585] Miscompiled inline assembly
nicos at maunakeatech dot com
gcc-bugzilla@gcc.gnu.org
Sat Mar 15 01:08:00 GMT 2008
------- Comment #4 from nicos at maunakeatech dot com 2008-03-15 01:07 -------
I think I need some help here, I looked to bug 323 and I can't see how it is
related to this issue.
The assertion at the end of the test case compares integers, and the iFloor
function is only applied to 0 in the test. My problem is that the result in
sp.bbox[0] seems total garbage.
I looked at the assembly code generated by gcc (-S flag), the portion
corresponding to:
sp.bbox[0] = std::min(sp.bbox[0], iFloor(txcum) );
is:
.L201:
fld %st(1)
fadd %st(2), %st
fsubs .LC4
#APP
fistpl -44(%ebp)
#NO_APP
movl -44(%ebp), %edi
movl -88(%ebp), %eax
sarl %edi
cmpl 16(%ebx), %edi
jge .L204
leal -28(%ebp), %eax
.L204:
fld %st(0)
movl (%eax), %eax
fadd %st(1), %st
fsubs .LC4
movl %eax, 16(%ebx)
The result of iFloor is stored in %edi but whatever the result of cmpl, the
value in %edi isn't used (instead the value at -28(%ebp), which appears to be
uninitialized, is stored into sp.bbox[0]).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35585
More information about the Gcc-bugs
mailing list