| Summary: | [3.4/4.0 Regression] Incorrect floating point optimization | ||
|---|---|---|---|
| Product: | gcc | Reporter: | Jakub Jelinek <jakub> |
| Component: | middle-end | Assignee: | Not yet assigned to anyone <unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | gcc-bugs |
| Priority: | P2 | Keywords: | patch, wrong-code |
| Version: | 3.4.0 | ||
| Target Milestone: | 3.4.1 | ||
| Host: | Target: | s390x-redhat-linux | |
| Build: | Known to work: | 3.3.3 | |
| Known to fail: | 3.4.0 | Last reconfirmed: | 2004-06-11 21:47:44 |
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-06/msg00767.html>. Subject: Bug 15945 CVSROOT: /cvs/gcc Module name: gcc Changes by: jakub@gcc.gnu.org 2004-06-14 17:45:09 Modified files: gcc : ChangeLog simplify-rtx.c Log message: PR middle-end/15945 * simplify-rtx.c (simplify_binary_operation): Don't optimize out Inf + -Inf, Inf - Inf, Inf / Inf and 0 * Inf if flag_trapping_math. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3963&r2=2.3964 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/simplify-rtx.c.diff?cvsroot=gcc&r1=1.192&r2=1.193 Subject: Bug 15945 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: jakub@gcc.gnu.org 2004-06-14 17:48:02 Modified files: gcc : ChangeLog simplify-rtx.c Log message: PR middle-end/15945 * simplify-rtx.c (simplify_binary_operation): Don't optimize out Inf + -Inf, Inf - Inf, Inf / Inf and 0 * Inf if flag_trapping_math. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.502&r2=2.2326.2.503 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/simplify-rtx.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.172.4.1&r2=1.172.4.2 Fixed. Target milestone should be 3.4.1. Andreas |
The following testcase is miscompiled with gcc-3_4-branch at -O3 on s390x-redhat-linux (worked properly in GCC 3.3.x and earlier). /* { dg-do run { target *-*-linux* } } */ /* { dg-options "-O3 -lm" } */ #include <fenv.h> #include <stdlib.h> typedef union { int i[2]; double x; } U; double __attribute__ ((noinline)) foo (double x) { U u, v; u.x = x; u.i[0] = 0x7ff00000; v.i[0] = 0x7ff00000; u.i[1] = 0; v.i[1] = 0; return u.x / v.x; } double d; int main (void) { feclearexcept (FE_ALL_EXCEPT); d = foo (2.0); if (fetestexcept (FE_INVALID) == 0) abort (); return 0; } Unless -ffast-math, the division should not be optimized out, as it is supposed to generate invalid exception. This causes miscompilation of glibc.