This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/30971] Wrong return value (Tail call optimization)
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 24 Jan 2016 22:13:23 +0000
- Subject: [Bug rtl-optimization/30971] Wrong return value (Tail call optimization)
- Auto-submitted: auto-generated
- References: <bug-30971-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30971
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2016-01-24
CC| |msebor at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
I can reproduce the abort on powerpc64* and x86_64, but since
-funsafe-math-optimizations implies -fno-signed-zeros which implies that the
sign of a zero result isn't significant it's not obvious to me that there's
anything wrong. Comment #3 suggests that the bug report might be based on a
misunderstanding of the effects of "-funsafe-math-optimizations is used
(fsigned-zeros is set in that case...)"
Revital, can you please clarify where you think the problem is?
Below is a slightly modified test case and its ouput.
$ cat gcc-30971.c && /home/msebor/build/gcc-trunk-svn/gcc/xgcc
-B/home/msebor/build/gcc-trunk-svn/gcc -Wall -Wextra -Wpedantic -O2
-funsafe-math-optimizations gcc-30971.c && ./a.out
double __attribute__ ((noclone, noinline)) func (double d, int n)
{
__builtin_printf ("%s(%e, %i)\n", __func__, d, n);
if (n == 0)
return d;
else
return d + func (d, n - 1);
}
int main ()
{
double x = func (0.0 / -5.0, 2);
__builtin_printf ("%e\n", x);
if (__builtin_copysign (1.0, x) != -1.0)
__builtin_abort ();
}
func(-0.000000e+00, 2)
func(-0.000000e+00, 1)
func(-0.000000e+00, 0)
0.000000e+00
Aborted (core dumped)