This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

optimization/2175: fold in fold_const.c associates non-multiply expressions



>Number:         2175
>Category:       optimization
>Synopsis:       fold in fold_const.c associates non-multiply expressions
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 04 23:06:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     B. Lucier
>Release:        3.0 prerelease and 3.1 experimental
>Organization:
>Environment:
all
>Description:
The comment in fold in fold_const.c implies that
operands of multiply expressions are associated when
-ffast-math if that may help optimization, but the
test for this should be code == MULT_EXPR, not
code != MULT_EXPR.
>How-To-Repeat:
Compile this file with -O2 -ffast-math and run it:

double x = -1.0e100;
int main()
{
  if ((1.0e100 + x) + 1.0 != 1.0)
    abort();
  return 0;
}

It aborts because gcc reassociates the addition, when it
shouldn't.  This is a regression from gcc-2.95.2.
>Fix:
Change code != MULT_EXPR to code == MULT_EXPR around line
5550 of gcc/fold-const.c.
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]