diff options
author | sisyphus <sisyphus@cpan.org> | 2019-04-28 17:32:30 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2019-04-28 21:13:32 -0600 |
commit | fd8eff8581b39b4698e33733844673435871e5bd (patch) | |
tree | bf4e6b9c3c26f38f36ab8e02f42125dfaadd99a8 | |
parent | 172b0a12e5e568cce1f8977327db24508a3f6e4e (diff) | |
download | perl-fd8eff8581b39b4698e33733844673435871e5bd.tar.gz |
ext/POSIX/t/posix.t: Fix undefined C behavior in test
Behavior marked as undefined by the C standard should be avoided. Its
a simple matter to fix this .t to not have such behavior.
In general, the programmer may not have control over the input string
being parsed to convert to a number, and so it could be too large or
tiny for the available precision and hence result in undefined behavior.
That is something that is unavoidable.
-rw-r--r-- | ext/POSIX/t/posix.t | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/POSIX/t/posix.t b/ext/POSIX/t/posix.t index 1fc36e2011..25099ea54a 100644 --- a/ext/POSIX/t/posix.t +++ b/ext/POSIX/t/posix.t @@ -206,11 +206,12 @@ SKIP: { # If this check fails then perl's buggy atof has probably assigned the value, # instead of the preferred Perl_strtod function. - $n = &POSIX::strtold('9.81256119e4820'); if($Config{nvtype} eq 'long double') { + $n = &POSIX::strtold('9.81256119e4820'); cmp_ok($n, '==', 9.81256119e4820, "strtold and perl agree $weasel_words"); } elsif($Config{nvtype} eq '__float128') { + $n = &POSIX::strtold('9.81256119e4820'); if($Config{longdblkind} == 1 || $Config{longdblkind} == 2) { cmp_ok($n, '==', 9.81256119e4820, "strtold and perl agree $weasel_words"); } |