public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/112338] New: ieee_set_halting_mode only affects the master thread outside of an OpenMP parallel region
@ 2023-11-01 16:49 vladimir.fuka at gmail dot com
2023-11-01 17:03 ` [Bug fortran/112338] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: vladimir.fuka at gmail dot com @ 2023-11-01 16:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112338
Bug ID: 112338
Summary: ieee_set_halting_mode only affects the master thread
outside of an OpenMP parallel region
Product: gcc
Version: 13.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: vladimir.fuka at gmail dot com
Target Milestone: ---
Calling ieee_set_halting_mode only affects the master thread if other threads
already exist and the call is done outside of a parallel region. I am not sure
what the Fortran standard and the OpenMP specifications prescribe, but the
following code produces different results with GCC and with Intel.
use ieee_exceptions
implicit none
integer, parameter :: n = 100
real :: nom(n)
integer :: denom(n)
logical :: saved_fpe_mode(size(ieee_all))
integer :: i
nom = 1
denom = 0
call ieee_set_halting_mode(ieee_overflow, .true.)
call ieee_set_halting_mode(ieee_invalid, .true.)
call ieee_set_halting_mode(ieee_divide_by_zero, .true.)
!$omp parallel
print *,"hello from a thread"
!$omp end parallel
call ieee_get_halting_mode(ieee_all, saved_fpe_mode)
call ieee_set_halting_mode(ieee_all, .false.)
!$omp parallel do
do i = 1, n
nom(i) = nom(i) / denom(i)
end do
!$omp end parallel do
nom = min(max(0., nom), 1.)
!$omp parallel
call ieee_set_halting_mode(ieee_all, saved_fpe_mode)
!$omp end parallel
print *, nom
end
With GCC
gfortran-13 -fopenmp -g fpe.f90
the code halts on line 28 (nom(i) = nom(i) / denom(i)) with SIGFPE:
Floating-point exception - erroneous arithmetic operation.
With Intel
ifx -qopenmp -g fpe.f90
the code does not halt and prints all 1.000000s.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug fortran/112338] ieee_set_halting_mode only affects the master thread outside of an OpenMP parallel region
2023-11-01 16:49 [Bug fortran/112338] New: ieee_set_halting_mode only affects the master thread outside of an OpenMP parallel region vladimir.fuka at gmail dot com
@ 2023-11-01 17:03 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-01 17:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112338
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
My bet it is not described ...
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-01 17:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-01 16:49 [Bug fortran/112338] New: ieee_set_halting_mode only affects the master thread outside of an OpenMP parallel region vladimir.fuka at gmail dot com
2023-11-01 17:03 ` [Bug fortran/112338] " pinskia 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).