static const double coeff[] = { +854513.0l /138 };
compiles as C almost everywhere, except ppc* with -mlong-double-128
-mabi=ibmlongdouble.
const_binop refuses to compute this:
      /* Don't constant fold this floating point operation if the
         result may dependent upon the run-time rounding mode and
         flag_rounding_math is set, or if GCC's software emulation
         is unable to accurately represent the result.  */

      if ((flag_rounding_math
           || (REAL_MODE_FORMAT_COMPOSITE_P (mode)
               && !flag_unsafe_math_optimizations))
          && (inexact || !real_identical (&result, &value)))
        return NULL_TREE;

Now, is the above valid ISO C99?  I couldn't find anything that would say this
is not a valid constant expression, certainly it fits into double's range.
Perhaps we should differentiate here if we are evaluating an initializer or
not.


-- 
           Summary: C constant expressions vs. IBM extended format long
                    double
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
GCC target triplet: powerpc*-linux


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

Reply via email to