FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian GCC

 
 
LinkBack Thread Tools
 
Old 01-25-2009, 04:00 PM
Aurelien Jarno
 
Default Bug#513007: gcc-4.3/alpha: -foptimize-sibling-calls generates wrong code

Package: gcc-4.3
Version: 4.3.2-4
Severity: important

gcc-4.3 on alpha generates wrong code when -foptimize-sibling-calls is
used (which is enabled at -O2). It was not the case with gcc 4.2, and
this is still reproducible with gcc from trunk from 20090106. This is
the reason why most of the complex tests of the glibc testsuite are
failing with gcc-4.3.

Here is a reduced testcase:

$ cat main.c
#include <math.h>
#include <complex.h>

__complex__ float my_print_complex (__complex__ float x);

int main()
{
__complex__ float a;
__real__ a = 9;
__imag__ a = 42;

my_print_complex(a);

return 0;
}
$ cat print.c
#include <complex.h>
#include <math.h>
#include <stdio.h>

__complex__ float internal_print_complex (__complex__ float x)
{

printf("%f+%fi
", __real__ x, __imag__ x);

if (__real__ x < 0)
{
__real__ x = -__real__ x;
}

return x;
}

__complex__ float my_print_complex (__complex__ float x)
{
return internal_print_complex (x);
}
$ gcc-4.3 -Wall -c main.c -o main.o
$ gcc-4.3 -O1 -foptimize-sibling-calls -Wall -c print.c -o print.o
$*gcc-4.3 -o test main.o print.o
$*./test
0.000000+0.000000i

When print.o is not compiled with -foptimize-sibling-calls, the result
is:
$./test
9.000000+42.000000i
$


-- System Information:
Debian Release: 5.0
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: alpha



--
To UNSUBSCRIBE, email to debian-gcc-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 

Thread Tools




All times are GMT. The time now is 10:43 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org