The testcase:

--cut here--
#include <stdio.h>

double
__attribute__ ((noinline))
test (double x)
{
  return x >= 0.0 ? x : -x;
}

double
__attribute__ ((always_inline))
test_inlined (double x)
{
  return x >= 0.0 ? x : -x;
}


int main()
{
  double x = -0.0;

  printf ("%f %f %f\n", x, test(x), test_inlined(x));
  return 0;
}
--cut here--

gcc -O2 abs.c
./a.out
-0.000000 0.000000 -0.000000


-- 
           Summary: Different results for inlined vs. non-inlined function
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ubizjak at gmail dot com
 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=35456

Reply via email to