public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug fortran/108329] New: IEEE_SET_ROUNDING_MODE ineffective with common subexpression elimination @ 2023-01-07 12:24 tkoenig at gcc dot gnu.org 2023-01-07 12:33 ` [Bug fortran/108329] " tkoenig at gcc dot gnu.org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: tkoenig at gcc dot gnu.org @ 2023-01-07 12:24 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108329 Bug ID: 108329 Summary: IEEE_SET_ROUNDING_MODE ineffective with common subexpression elimination Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: tkoenig at gcc dot gnu.org Target Milestone: --- Split from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34678#c47 . The test case $ cat y.f90 module y implicit none integer, parameter :: wp = selected_real_kind(15) contains subroutine foo(a,b,c) use ieee_arithmetic real(kind=wp), dimension(4), intent(out) :: a real(kind=wp), intent(in) :: b, c type (ieee_round_type), dimension(4), parameter :: mode = & [ieee_nearest, ieee_to_zero, ieee_up, ieee_down] call ieee_set_rounding_mode (mode(1)) a(1) = b + c call ieee_set_rounding_mode (mode(2)) a(2) = b + c call ieee_set_rounding_mode (mode(3)) a(3) = b + c call ieee_set_rounding_mode (mode(4)) a(4) = b + c end subroutine foo end module y program main use y real(kind=wp), dimension(4) :: a call foo(a, 0.1_wp, 0.2_wp) print *,a end program main $ gfortran -O y.f90 && ./a.out 0.30000000000000004 0.30000000000000004 0.30000000000000004 0.30000000000000004 $ gfortran y.f90 && ./a.out 0.30000000000000004 0.29999999999999999 0.30000000000000004 0.29999999999999999 shows that common subexpression removal causes the addition to be performed only once. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/108329] IEEE_SET_ROUNDING_MODE ineffective with common subexpression elimination 2023-01-07 12:24 [Bug fortran/108329] New: IEEE_SET_ROUNDING_MODE ineffective with common subexpression elimination tkoenig at gcc dot gnu.org @ 2023-01-07 12:33 ` tkoenig at gcc dot gnu.org 2023-01-07 12:47 ` tkoenig at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: tkoenig at gcc dot gnu.org @ 2023-01-07 12:33 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108329 Thomas Koenig <tkoenig at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|unknown |13.0 Depends on| |34678 Keywords| |wrong-code Blocks| |105105 --- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- As long as PR 36678 is not fixed, I see one possible solution in putting a memory barrier after ieee_set_rounding_mode. This is a rather big hammer, but as long as the middle-end issue is not fixed, I do not see an alternative. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=34678 [Bug 34678] Optimization generates incorrect code with -frounding-math option (#pragma STDC FENV_ACCESS not implemented) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105105 [Bug 105105] [Meta] Fortran IEEE support ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/108329] IEEE_SET_ROUNDING_MODE ineffective with common subexpression elimination 2023-01-07 12:24 [Bug fortran/108329] New: IEEE_SET_ROUNDING_MODE ineffective with common subexpression elimination tkoenig at gcc dot gnu.org 2023-01-07 12:33 ` [Bug fortran/108329] " tkoenig at gcc dot gnu.org @ 2023-01-07 12:47 ` tkoenig at gcc dot gnu.org 2023-01-07 15:50 ` tkoenig at gcc dot gnu.org 2023-01-09 15:27 ` tkoenig at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: tkoenig at gcc dot gnu.org @ 2023-01-07 12:47 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108329 --- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- (In reply to Thomas Koenig from comment #1) > As long as PR 36678 That should be PR 34678 . ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/108329] IEEE_SET_ROUNDING_MODE ineffective with common subexpression elimination 2023-01-07 12:24 [Bug fortran/108329] New: IEEE_SET_ROUNDING_MODE ineffective with common subexpression elimination tkoenig at gcc dot gnu.org 2023-01-07 12:33 ` [Bug fortran/108329] " tkoenig at gcc dot gnu.org 2023-01-07 12:47 ` tkoenig at gcc dot gnu.org @ 2023-01-07 15:50 ` tkoenig at gcc dot gnu.org 2023-01-09 15:27 ` tkoenig at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: tkoenig at gcc dot gnu.org @ 2023-01-07 15:50 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108329 Thomas Koenig <tkoenig at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Last reconfirmed| |2023-01-07 Assignee|unassigned at gcc dot gnu.org |tkoenig at gcc dot gnu.org Status|UNCONFIRMED |ASSIGNED ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/108329] IEEE_SET_ROUNDING_MODE ineffective with common subexpression elimination 2023-01-07 12:24 [Bug fortran/108329] New: IEEE_SET_ROUNDING_MODE ineffective with common subexpression elimination tkoenig at gcc dot gnu.org ` (2 preceding siblings ...) 2023-01-07 15:50 ` tkoenig at gcc dot gnu.org @ 2023-01-09 15:27 ` tkoenig at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: tkoenig at gcc dot gnu.org @ 2023-01-09 15:27 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108329 Thomas Koenig <tkoenig at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |NEW Assignee|tkoenig at gcc dot gnu.org |unassigned at gcc dot gnu.org --- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> --- Seems to be much more complicated than I thought, see the thrad starting at https://gcc.gnu.org/pipermail/gcc-patches/2023-January/609532.html ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-01-09 15:27 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-01-07 12:24 [Bug fortran/108329] New: IEEE_SET_ROUNDING_MODE ineffective with common subexpression elimination tkoenig at gcc dot gnu.org 2023-01-07 12:33 ` [Bug fortran/108329] " tkoenig at gcc dot gnu.org 2023-01-07 12:47 ` tkoenig at gcc dot gnu.org 2023-01-07 15:50 ` tkoenig at gcc dot gnu.org 2023-01-09 15:27 ` tkoenig at gcc dot gnu.org
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).