public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
[not found] <bug-19116-9515@http.gcc.gnu.org/bugzilla/>
@ 2006-08-25 9:01 ` rguenth at gcc dot gnu dot org
2006-10-21 10:41 ` rguenth at gcc dot gnu dot org
` (8 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-08-25 9:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from rguenth at gcc dot gnu dot org 2006-08-25 09:01 -------
Mine. This "regression" was introduced at the time we got rid of
flag_fast_math and changed it to either flag_unsafe_math_optimizations or
flag_trapping_math.
+2001-03-07 Brad Lucier <lucier@math.purdue.edu>
+
+ * builtins.c (expand_builtin_mathfn): Check
+ flag_unsafe_math_optimizations, not flag_fast_math.
+ (expand_builtin): Likewise
+ * combine.c (combine_simplify_rtx): Likewise.
+ (simplify_if_then_else): Likewise.
+ * cse.c (fold_rtx): Likewise.
+ * flags.h: Remove flag_fast_math. Add
+ flag_unsafe_math_optimizations and flag_trapping_math.
+ * fold-const.c (negate_expr): Check
+ flag_unsafe_math_optimizations, not flag_fast_math.
+ (invert_truthvalue): Likewise.
+ (fold): Likewise. Before associating operands, check that
+ code == MULT_EXPR, not code != MULT_EXPR.
+ * ifcvt.c (noce_try_minmax): Check
+ flag_unsafe_math_optimizations, not flag_fast_math.
+ (noce_operand_ok): Check flag_trapping_math, not flag_fast_math.
+ * invoke.texi: Document -funsafe-math-optimizations and
+ -fno-trapping-math. Change documentation for -ffast-math.
+ * jump.c (reversed_comparison_code_parts): Likewise.
+ (rtx_equal_for_thread_p): Likewise.
+ * optabs.c (emit_conditional_move): Likewise.
+ * simplify-rtx.c (simplify_binary_operation): Likewise.
+ (simplify_relational_operation): Likewise.
+ (simplify_ternary_operation): Likewise.
+ * toplev.c: Remove flag_fast_math. Add flag_trapping_math and
+ flag_unsafe_math_optimizations. Remove fast-math entry from f_options.
+ Add trapping-math and unsafe-math-optimizations entries to f_options.
+ (set_fast_math_flags): New, sets flags for -ffast-math.
+ (set_no_fast_math_flags): New, sets flags for -fno-fast-math.
+ (decode_f_option): Add code to handle -ffast-math and -fno-fast-math.
+ * toplev.h: Declare set_fast_math_flags and set_no_fast_math_flags.
+
+ * config/alpha/alpha.c (alpha_emit_conditional_branch): Likewise.
+ (alpha_emit_conditional_move): Initialize local_fast_math to
+ flag_unsafe_math_optimizations, not flat_fast_math.
+ * config/c4x/c4x.c (c4x_override_options): Call set_fast_math_flags
+ instead of setting flag_fast_math to 1.
+ * config/convex/convex.md: Check flag_unsafe_math_optimizations,
+ not flag_fast_math.
+ * config/i386/i386.c (override_options): Likewise
+ * config/i386/i386.md: Likewise.
+ * config/m68k/m68k.md: Likewise.
+ * config/mips/mips.md: Likewise.
+ * config/rs6000/rs6000.c (validate_condition_mode): Likewise.
+ (rs6000_generate_compare): Likewise.
Later flag_finite_math_only was introduced but not all other places fixed.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2005-09-24 16:53:42 |2006-08-25 09:01:01
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
[not found] <bug-19116-9515@http.gcc.gnu.org/bugzilla/>
2006-08-25 9:01 ` [Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that) rguenth at gcc dot gnu dot org
@ 2006-10-21 10:41 ` rguenth at gcc dot gnu dot org
2006-10-21 10:42 ` rguenth at gcc dot gnu dot org
` (7 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-10-21 10:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from rguenth at gcc dot gnu dot org 2006-10-21 10:41 -------
Subject: Bug 19116
Author: rguenth
Date: Sat Oct 21 10:40:57 2006
New Revision: 117930
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117930
Log:
2006-10-21 Richard Guenther <rguenther@suse.de>
PR target/19116
* config/i386/i386.c (override_options): Do not set MASK_IEEE_FP
if flag_unsafe_math_optimizations is specified. We have
flag_finite_math_only for that.
* config/i386/i386.md (sqrtxf2): Do not require TARGET_IEEE_FP
or flag_unsafe_math_optimizations.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386.c
trunk/gcc/config/i386/i386.md
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
[not found] <bug-19116-9515@http.gcc.gnu.org/bugzilla/>
2006-08-25 9:01 ` [Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that) rguenth at gcc dot gnu dot org
2006-10-21 10:41 ` rguenth at gcc dot gnu dot org
@ 2006-10-21 10:42 ` rguenth at gcc dot gnu dot org
2006-11-03 22:35 ` pinskia at gcc dot gnu dot org
` (6 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-10-21 10:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from rguenth at gcc dot gnu dot org 2006-10-21 10:42 -------
Fixed.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
[not found] <bug-19116-9515@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2006-10-21 10:42 ` rguenth at gcc dot gnu dot org
@ 2006-11-03 22:35 ` pinskia at gcc dot gnu dot org
2006-11-04 10:54 ` ubizjak at gmail dot com
` (5 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-11-03 22:35 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from pinskia at gcc dot gnu dot org 2006-11-03 22:35 -------
*** Bug 29705 has been marked as a duplicate of this bug. ***
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |james dot me at gmail dot
| |com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
[not found] <bug-19116-9515@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2006-11-03 22:35 ` pinskia at gcc dot gnu dot org
@ 2006-11-04 10:54 ` ubizjak at gmail dot com
2006-11-04 13:30 ` rguenth at gcc dot gnu dot org
` (4 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: ubizjak at gmail dot com @ 2006-11-04 10:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #14 from ubizjak at gmail dot com 2006-11-04 10:53 -------
According to PR 29705 (testcase is included in the PR) this is a wrong code bug
on 4.2 (and possibly others) branch.
--
ubizjak at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ubizjak at gmail dot com
Status|RESOLVED |REOPENED
Known to fail| |4.0.0 4.1.0 4.2.0
Known to work| |4.3.0
Resolution|FIXED |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
[not found] <bug-19116-9515@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2006-11-04 10:54 ` ubizjak at gmail dot com
@ 2006-11-04 13:30 ` rguenth at gcc dot gnu dot org
2006-11-04 16:27 ` james dot me at gmail dot com
` (3 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-11-04 13:30 UTC (permalink / raw)
To: gcc-bugs
------- Comment #15 from rguenth at gcc dot gnu dot org 2006-11-04 13:30 -------
But it's not a regression.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
[not found] <bug-19116-9515@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2006-11-04 13:30 ` rguenth at gcc dot gnu dot org
@ 2006-11-04 16:27 ` james dot me at gmail dot com
2006-11-04 16:32 ` rguenth at gcc dot gnu dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 12+ messages in thread
From: james dot me at gmail dot com @ 2006-11-04 16:27 UTC (permalink / raw)
To: gcc-bugs
------- Comment #16 from james dot me at gmail dot com 2006-11-04 16:26 -------
I applied Richard Guenther's patch to my own 4.2 svn branch to get this fixed
locally, but the change had no effect. I am a little puzzled by this, because
what I can discern from the discussion and comments the change:
/* If we're doing fast math, we don't care about comparison order
wrt NaNs. This lets us use a shorter comparison sequence. */
- if (flag_unsafe_math_optimizations)
+ if (flag_finite_math_only)
target_flags &= ~MASK_IEEE_FP;
is a definitive fix.
What else is going on here?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
[not found] <bug-19116-9515@http.gcc.gnu.org/bugzilla/>
` (6 preceding siblings ...)
2006-11-04 16:27 ` james dot me at gmail dot com
@ 2006-11-04 16:32 ` rguenth at gcc dot gnu dot org
2006-11-06 9:33 ` rguenth at gcc dot gnu dot org
2006-11-06 9:34 ` rguenth at gcc dot gnu dot org
9 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-11-04 16:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #17 from rguenth at gcc dot gnu dot org 2006-11-04 16:32 -------
There is another one in simplify-rtx.c:
Author: rguenth
Date: Sat Oct 21 10:13:13 2006
New Revision: 117928
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117928
Log:
2006-10-21 Richard Guenther <rguenther@suse.de>
PR middle-end/28796
* simplify-rtx.c (simplify_const_relational_operation):
Do not constant-fold ORDERED and UNORDERED for
flag_unsafe_math_optimizations but only we do not need to
honor NaNs for the given mode.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/simplify-rtx.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
[not found] <bug-19116-9515@http.gcc.gnu.org/bugzilla/>
` (7 preceding siblings ...)
2006-11-04 16:32 ` rguenth at gcc dot gnu dot org
@ 2006-11-06 9:33 ` rguenth at gcc dot gnu dot org
2006-11-06 9:34 ` rguenth at gcc dot gnu dot org
9 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-11-06 9:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #18 from rguenth at gcc dot gnu dot org 2006-11-06 09:33 -------
Subject: Bug 19116
Author: rguenth
Date: Mon Nov 6 09:33:16 2006
New Revision: 118517
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=118517
Log:
2006-11-06 Richard Guenther <rguenther@suse.de>
Backport from mainline:
2006-10-21 Richard Guenther <rguenther@suse.de>
PR target/19116
* config/i386/i386.c (override_options): Do not set MASK_IEEE_FP
if flag_unsafe_math_optimizations is specified. We have
flag_finite_math_only for that.
* config/i386/i386.md (sqrtxf2): Do not require TARGET_IEEE_FP
or flag_unsafe_math_optimizations.
PR middle-end/28796
* simplify-rtx.c (simplify_const_relational_operation):
Do not constant-fold ORDERED and UNORDERED for
flag_unsafe_math_optimizations but only we do not need to
honor NaNs for the given mode.
Modified:
branches/gcc-4_2-branch/gcc/ChangeLog
branches/gcc-4_2-branch/gcc/config/i386/i386.c
branches/gcc-4_2-branch/gcc/config/i386/i386.md
branches/gcc-4_2-branch/gcc/simplify-rtx.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that)
[not found] <bug-19116-9515@http.gcc.gnu.org/bugzilla/>
` (8 preceding siblings ...)
2006-11-06 9:33 ` rguenth at gcc dot gnu dot org
@ 2006-11-06 9:34 ` rguenth at gcc dot gnu dot org
9 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-11-06 9:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #19 from rguenth at gcc dot gnu dot org 2006-11-06 09:34 -------
Fixed for 4.2.0. The RM decided it's not worth the change in behavior during
the 4.1/4.0 series (I agree).
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|REOPENED |RESOLVED
Resolution| |FIXED
Target Milestone|4.3.0 |4.2.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug driver/19116] New: -fno-finite-math-only does not override -ffast-math
@ 2004-12-21 20:36 Thomas dot Koenig at online dot de
2004-12-27 14:00 ` [Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that) pinskia at gcc dot gnu dot org
2005-01-17 13:42 ` hunor at cs dot bme dot hu
0 siblings, 2 replies; 12+ messages in thread
From: Thomas dot Koenig at online dot de @ 2004-12-21 20:36 UTC (permalink / raw)
To: gcc-bugs
$ cat nan-find.f90
program main
real :: a,b,c
logical :: l
b = 0.
c = 0.
a = b/c
call nanfind(a,a,l)
if (l) then
print *,a,"compares equal to itself"
else
print *,a,"compares unequal to itself"
end if
end program main
subroutine nanfind(a,b,l)
real,intent(in) :: a,b
logical, intent(out) :: l
l = a == b
end subroutine nanfind
$ gfortran -O3 -ffast-math -fno-finite-math-only nan-find.f90
$ ./a.out
NaN compares equal to itself
$ gfortran -v
Using built-in specs.
Configured with: ../gcc/configure --prefix=/home/ig25
--enable-languages=c,c++,f95 : (reconfigured) ../gcc/configure
--prefix=/home/ig25 --enable-languages=c,c++,f95
Thread model: posix
gcc version 4.0.0 20041221 (experimental)
$
Then again, I never liked the fact that NaNs can compare
equal with any compiler option...
--
Summary: -fno-finite-math-only does not override -ffast-math
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: driver
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: Thomas dot Koenig at online dot de
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19116
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2006-11-06 9:34 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-19116-9515@http.gcc.gnu.org/bugzilla/>
2006-08-25 9:01 ` [Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that) rguenth at gcc dot gnu dot org
2006-10-21 10:41 ` rguenth at gcc dot gnu dot org
2006-10-21 10:42 ` rguenth at gcc dot gnu dot org
2006-11-03 22:35 ` pinskia at gcc dot gnu dot org
2006-11-04 10:54 ` ubizjak at gmail dot com
2006-11-04 13:30 ` rguenth at gcc dot gnu dot org
2006-11-04 16:27 ` james dot me at gmail dot com
2006-11-04 16:32 ` rguenth at gcc dot gnu dot org
2006-11-06 9:33 ` rguenth at gcc dot gnu dot org
2006-11-06 9:34 ` rguenth at gcc dot gnu dot org
2004-12-21 20:36 [Bug driver/19116] New: -fno-finite-math-only does not override -ffast-math Thomas dot Koenig at online dot de
2004-12-27 14:00 ` [Bug target/19116] -funsafe-math-optimizations make nan compares equal to one another (-finite-math-only should be doing that) pinskia at gcc dot gnu dot org
2005-01-17 13:42 ` hunor at cs dot bme dot hu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).