-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
The previous commit exposed undefined behaviour elsewhere that is the result of old ksh bugs. My 2021 attempt to fix it in 23b7a16 was also wrong. src/cmd/ksh93/sh/init.c: put_rand(), put_lineno(), put_lastarg(): - An incorrect typecast to double instead of Sfdouble_t (which translates to 'long double' on most systems, but not on macOS M1) caused arithmetic assignments to RANDOM, LINENO and _ to produce undefined results where sizeof(long double)!=sizeof(double). As ksh has been using Sfdouble_t for all arithmetic operations for years, fix the bug by typecasting to Sfdouble_t instead. src/cmd/ksh93/tests/arith.sh: - Fix the tests added in the previous commit to tolerate system-dependent rounding errors.
- Loading branch information
Showing
3 changed files
with
25 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters