Bug 27054 - C constant expressions vs. IBM extended format long double
Summary: C constant expressions vs. IBM extended format long double
Status: RESOLVED DUPLICATE of bug 26374
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-06 10:14 UTC by Jakub Jelinek
Modified: 2006-04-06 16:13 UTC (History)
7 users (show)

See Also:
Host:
Target: powerpc*-linux
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2006-04-06 10:14:42 UTC
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.
Comment 1 Andrew Pinski 2006-04-06 16:13:56 UTC
This is a dup of bug 26374.

*** This bug has been marked as a duplicate of 26374 ***