This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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] |
Hi! The libm-test infrastructure currently doesn't allow for switching to a non-default (that is, non-POSIX) error handling behavior. Doing so is needed for additional tests, such as those suggested in <http://sourceware.org/PR14686>, for example. Here is a patch that works by having the test harness temporarily set _LIB_VERSION accordingly. Then you can use statements like: TEST_ff_f_IEEE (remainder, 1, 0, qnan_value, INVALID_EXCEPTION); ... to indicate that this test should be run in the IEEE environment. Per math/Makefile:CPPFLAGS-s_lib_version.c, the default is POSIX, and <math.h> also allows for switching to SVID, XOPEN, ISOC. math/math.h: /* This variable can be changed at run-time to any of the values above to affect floating point error handling behavior (it may also be necessary to change the hardware FPU exception settings). */ extern _LIB_VERSION_TYPE _LIB_VERSION; How to address the part of the comment suggesting that we might have to change the hardware FPU exception settings? A few architectures define _FPU_IEEE, and have fesetenv use that for FE_NOMASK_ENV, but using the latter is not the right thing to do as that would cause any floating point exception to raise SIGFPE. On the other hand, it seems to me that linking with -lieee (math/Makefile: ÂThe -lieee module sets the _LIB_VERSION_ switch to IEEE mode for error handling in the -lm functions.Â) appears to be equivalent to just setting _LIB_VERSION to _IEEE_ (as I'm doing in my patch), and also doesn't seem to cause any special hardware FPU exception settings? diff --git math/gen-libm-test.pl math/gen-libm-test.pl index aa60d9d..5dfa880 100755 --- math/gen-libm-test.pl +++ math/gen-libm-test.pl @@ -226,7 +226,7 @@ sub special_functions { # Parse the arguments to TEST_x_y sub parse_args { my ($file, $descr, $fct, $args) = @_; - my (@args, $str, $descr_args, $descr_res, @descr); + my (@args, $str, $descr_args, $descr_res, $descr_env, @descr); my ($current_arg, $cline, $i); my ($pre, $post, @special); my ($extra_var, $call, $c_call); @@ -235,7 +235,7 @@ sub parse_args { &special_functions ($file, $args); return; } - ($descr_args, $descr_res) = split /_/,$descr, 2; + ($descr_args, $descr_res, $descr_env) = split /_/,$descr, 3; @args = split /,\s*/, $args; @@ -272,6 +272,7 @@ sub parse_args { } $call .= ')'; $str = "$call == "; + $str = "_${descr_env}_ $str" if (defined $descr_env); # Result @descr = split //,$descr_res; @@ -376,6 +377,7 @@ sub parse_args { if ($args[0] eq 'frexp') { if (defined $special[0] && $special[0] ne "IGNORE") { my ($str) = "$call sets x to $special[0]"; + $str = "_${descr_env}_ $str" if (defined $descr_env); $post = " check_int (\"$str\", x, $special[0]"; $post .= &new_test ($str, undef); } @@ -383,28 +385,38 @@ sub parse_args { $pre = " signgam = 0;\n"; if (defined $special[0] && $special[0] ne "IGNORE") { my ($str) = "$call sets signgam to $special[0]"; + $str = "_${descr_env}_ $str" if (defined $descr_env); $post = " check_int (\"$str\", signgam, $special[0]"; $post .= &new_test ($str, undef); } } elsif ($args[0] eq 'modf') { if (defined $special[0] && $special[0] ne "IGNORE") { my ($str) = "$call sets x to $special[0]"; + $str = "_${descr_env}_ $str" if (defined $descr_env); $post = " check_float (\"$str\", x, $special[0]"; $post .= &new_test ($str, undef); } } elsif ($args[0] eq 'remquo') { if (defined $special[0] && $special[0] ne "IGNORE") { my ($str) = "$call sets x to $special[0]"; + $str = "_${descr_env}_ $str" if (defined $descr_env); $post = " check_int (\"$str\", x, $special[0]"; $post .= &new_test ($str, undef); } } - if (defined $pre or defined $post) { + if (defined $pre or defined $post or defined $descr_env) { print $file " {\n"; + if (defined $descr_env) { + print $file " _LIB_VERSION_TYPE prev_LIB_VERSION = _LIB_VERSION;\n"; + print $file " _LIB_VERSION = _${descr_env}_;\n"; + } print $file " $pre" if (defined $pre); print $file " $cline"; print $file " $post" if (defined $post); + if (defined $descr_env) { + print $file " _LIB_VERSION = prev_LIB_VERSION;\n"; + } print $file " }\n"; } else { print $file " $cline"; GrÃÃe, Thomas
Attachment:
pgpfUazO4PMXb.pgp
Description: PGP signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |