[Bug tree-optimization/27394] New: double -> char conversion varies with optimization level

amylaar at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue May 2 17:14:00 GMT 2006


This testcase:

int
f
()
{
  double d = 128.;
  return (signed char) d;
}


int
main ()
{
  return f () != -128;
}

Succeeds at -O0 and fails at -O1.  While the C standard says that the result
of the conversion is unspecified, it is a quality of implementation issue to
give, where reasonably possible, the same results when optimizing as when
not optimizing.  Doing otherwise makes debugging unnecessarily difficult.


-- 
           Summary: double -> char conversion varies with optimization level
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: amylaar at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27394



More information about the Gcc-bugs mailing list