This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/24597] New: Function call with negated value after test is done wrongly
- From: "jbglaw at lug-owl dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 Oct 2005 15:47:02 -0000
- Subject: [Bug c/24597] New: Function call with negated value after test is done wrongly
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I'm currently on the way writing a smallish libm for VAX, using GCC from SVN
plus some (mostly configury) patches. The code attached (it's hackish)
doesn't work. Basically, this flow of code is broken:
long double sinl (long double x) {
if (x < 0.0)
return -sin (-x)
:
:
}
After discovery on VAX, I tested it on my PC and it failed there, too.
The generated assembly (for VAX; i386 is near unreadable...) looks like
test x
if less_than_zero
push x ## negation is missing
call sin();
:
else
something_else;
So this results in recursive calls until stack is full and VM kills the
test program.
The attached program can be compiled with:
$ make TARGET=xxxx
With "xxxx" being something like "i686-pc-linux-gnu-" if that's the
compiler you're testing with.
Thanks,
Jan-Benedict Glaw
--
Summary: Function call with negated value after test is done
wrongly
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jbglaw at lug-owl dot de
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24597