|
From: Joerg B. <jo...@we...> - 2003-08-01 09:11:16
|
Andreas Fredriksson wrote:
> Hi Nicholas,
>
> it seems I was a bit quick to type, cosf() actually works,
> what I really meant was acosf():
>
> #include <math.h>
>
> int main(int argc, char** argv)
> {
> float f = asinf(0.5);
> return 0;
> }
>
> gives me:
>
> $ valgrind /tmp/acostest
> ==4163== Memcheck, a.k.a. Valgrind, a memory error detector for x86-linux.
> ==4163== Copyright (C) 2002, and GNU GPL'd, by Julian Seward.
> ==4163== Using valgrind-1.9.6, a program instrumentation system for
> x86-linux.
> ==4163== Copyright (C) 2000-2002, and GNU GPL'd, by Julian Seward.
> ==4163== Estimated CPU clock rate is 1754 MHz
> ==4163== For more details, rerun with: -v
> ==4163==
> REPE then 0xF
>
> valgrind: the `impossible' happened:
> Unhandled REPE case
> Basic block ctr is approximately 0
>
> sched status:
>
> Thread 1: status = Runnable, associated_mx = 0x0, associated_cv = 0x0
> ==4163== at 0x4022D502: __acosf (in /lib/libm-2.3.2.so)
> ==4163== by 0x80483A3: main (in /tmp/acostest)
> ==4163== by 0x402557A6: __libc_start_main (in /lib/libc-2.3.2.so)
> ==4163== by 0x80482F0: (within /tmp/acostest)
>
> Regards,
> Andreas
Andrea,
with my setup, it works:
joerg> gcc main.c -lm
joerg> ./a.out
joerg> gcc main.c -lm && valgrind a.out
==19228== Memcheck, a.k.a. Valgrind, a memory error detector for x86-linux.
==19228== Copyright (C) 2002-2003, and GNU GPL'd, by Julian Seward.
==19228== Using valgrind-20030716, a program supervision framework for
x86-linux .
==19228== Copyright (C) 2000-2003, and GNU GPL'd, by Julian Seward.
==19228== Estimated CPU clock rate is 2797 MHz
==19228== For more details, rerun with: -v
==19228==
==19228==
==19228== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==19228== malloc/free: in use at exit: 0 bytes in 0 blocks.
==19228== malloc/free: 0 allocs, 0 frees, 0 bytes allocated.
==19228== For a detailed leak analysis, rerun with: --leak-check=yes
==19228== For counts of detected errors, rerun with: -v
joerg> gcc --version
gcc (GCC) 3.2 (SuSE Linux)
so, maybe a newer valgrind my help you?
if that is not the case, we could compare the assembler code of the
example:
joerg> gcc -S main.c && cat main.s
cat main.s
.file "main.c"
.text
.align 2
.globl main
.type main,@function
main:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
andl $-16, %esp
movl $0, %eax
subl %eax, %esp
subl $12, %esp
pushl $0x3f000000
call asinf
addl $16, %esp
fstps -4(%ebp)
movl $0, %eax
leave
ret
.Lfe1:
.size main,.Lfe1-main
.ident "GCC: (GNU) 3.2 (SuSE Linux)"
mybe the difference is in the math-lib?
joerg> ldd a.out
libm.so.6 => /lib/libm.so.6 (0x40022000)
libc.so.6 => /lib/libc.so.6 (0x40045000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
hope that helps
Joerg
|