J
jacob navia
#include <stdio.h>
char Fn5973(float arg1,long long arg2)
{
return arg2 - arg1 + arg1 - arg1 + arg1 + arg1 * arg1 - arg1;
}
int main(void)
{
long double mm;
mm = Fn5973(14907.5F,20524);
printf("result of Fn5973=%.20Lg\n",mm);
}
Without optimizations answer is zero
jacob@ubuntu-32:/tmp$ gcc bug1.c -o bug1
jacob@ubuntu-32:/tmp$ ./bug1
result of Fn5973=0
With optimizations answer is -64
jacob@ubuntu-32:/tmp$ gcc -O3 bug1.c -o bug1opt
jacob@ubuntu-32:/tmp$ ./bug1opt
result of Fn5973=-64
jacob@ubuntu-32:/tmp$ gcc -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2/specs
Configured with: ../gcc-3.2/configure --enable-language=c,c++
Thread model: posix
gcc version 3.2
jacob@ubuntu-32:/tmp$
can anyone infirm/confirm this?
Thanks
char Fn5973(float arg1,long long arg2)
{
return arg2 - arg1 + arg1 - arg1 + arg1 + arg1 * arg1 - arg1;
}
int main(void)
{
long double mm;
mm = Fn5973(14907.5F,20524);
printf("result of Fn5973=%.20Lg\n",mm);
}
Without optimizations answer is zero
jacob@ubuntu-32:/tmp$ gcc bug1.c -o bug1
jacob@ubuntu-32:/tmp$ ./bug1
result of Fn5973=0
With optimizations answer is -64
jacob@ubuntu-32:/tmp$ gcc -O3 bug1.c -o bug1opt
jacob@ubuntu-32:/tmp$ ./bug1opt
result of Fn5973=-64
jacob@ubuntu-32:/tmp$ gcc -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/3.2/specs
Configured with: ../gcc-3.2/configure --enable-language=c,c++
Thread model: posix
gcc version 3.2
jacob@ubuntu-32:/tmp$
can anyone infirm/confirm this?
Thanks