https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91337
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #1 from kargl at gcc dot gnu.org ---
(In reply to Chinoune from comment #0)
> I have encountered some underflows/overflows in my code compiled with
> -Ofast, and after investigations it seems like the complex abs gives zero
> with small numbers. So I added a workaround. but it didn't work:
>
(snip)
>
> gfortran-9 -O1 -funsafe-math-optimizations -ffinite-math-only
> bug_skip_if.f90 -o test.x
> ./test.x
(snip)
>
> Q : Why does gfortran skip the if statement?
What happens if you don't use options that allow
a compiler to violate the standard?
'-Ofast'
Disregard strict standards compliance. '-Ofast' enables all '-O3'
optimizations. It also enables optimizations that are not valid
for all standard-compliant programs. It turns on '-ffast-math' and
the Fortran-specific '-fstack-arrays', unless
'-fmax-stack-var-size' is specified, and '-fno-protect-parens'.
'-ffast-math'
Sets the options '-fno-math-errno', '-funsafe-math-optimizations',
'-ffinite-math-only', '-fno-rounding-math', '-fno-signaling-nans',
'-fcx-limited-range' and '-fexcess-precision=fast'.
This option causes the preprocessor macro '__FAST_MATH__' to be
defined.
This option is not turned on by any '-O' option besides '-Ofast'
since it can result in incorrect output for programs that depend on
an exact implementation of IEEE or ISO rules/specifications for
math functions. It may, however, yield faster code for programs
that do not require the guarantees of these specifications.
'-funsafe-math-optimizations'
Allow optimizations for floating-point arithmetic that (a) assume
that arguments and results are valid and (b) may violate IEEE or
ANSI standards. When used at link time, it may include libraries
or startup files that change the default FPU control word or other
similar optimizations.
This option is not turned on by any '-O' option since it can result
in incorrect output for programs that depend on an exact
implementation of IEEE or ISO rules/specifications for math
functions