This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran,patch] Add option to raise FPE


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]