This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gfortran,patch] Add option to raise FPE
- From: Richard Henderson <rth at redhat dot com>
- To: François-Xavier Coudert <fxcoudert at gmail dot com>
- Cc: gfortran <fortran at gcc dot gnu dot org>, patch <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 19 Aug 2005 17:54:47 -0700
- Subject: Re: [gfortran,patch] Add option to raise FPE
- References: <19c433eb050819161749f6fb8f@mail.gmail.com>
On Sat, Aug 20, 2005 at 01:17:51AM +0200, François-Xavier Coudert wrote:
> + int * const opt_exception[] = { &(gfc_option.fpe_invalid),
> + &(gfc_option.fpe_denormal),
> + &(gfc_option.fpe_zero),
> + &(gfc_option.fpe_overflow),
> + &(gfc_option.fpe_underflow),
> + &(gfc_option.fpe_precision) };
Need/want static. Why the extra parenthesis?
> + gfor_fndecl_set_fpe =
> + gfc_build_library_function_decl (get_identifier (PREFIX("set_fpe")),
> + void_type_node, 6,
> + gfc_c_int_type_node, gfc_c_int_type_node,
> + gfc_c_int_type_node, gfc_c_int_type_node,
> + gfc_c_int_type_node, gfc_c_int_type_node);
Why 6 arguments and not one bitmask?
> +#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
"*&" doesn't make sense, wherever you copied that from.
> --- gcc/libgfortran/config/fpu-387-sse.h
Why separate i386/sse code? You might as well just detect sse
at runtime. There are pleanty of examples of this in the code
base already.
IMO you should have special code for glibc using feenableexcept,
and use that preferentially on all gnu systems. libgfortran has
a fairly tight binding to libm already, so that should be no
problem.
> - {"GFORTRAN_FPU_INVALID", 1, &options.fpu_invalid, init_boolean,
> + {"GFORTRAN_FPU_INVALID", -1, &options.fpu_invalid, init_boolean,
> show_boolean,
> "Raise a floating point exception on invalid FP operation.", 0},
Surely you want the command-line argument instead of an environment
variable, and not some tricky interaction between them?
r~