Merge pull request #1214 from xexyl/1989-westley-status
This commit is contained in:
3 files changed
+63
-31
No files matched your search
@@ -15,8 +15,7 @@ make all
|
||||
This entry a listed in [bugs.md](/bugs.md) as:
|
||||
|
||||
```
|
||||
STATUS: main() function args not allowed - please help us fix
|
||||
STATUS: known bug - please help us fix
|
||||
STATUS: INABIAF - please **DO NOT** fix
|
||||
```
|
||||
|
||||
For more detailed information see [bugs.md](/bugs.md#1989westley-readmemd).
|
||||
|
||||
@@ -512,21 +512,7 @@ numbers with non-binary digits.
|
||||
|
||||
|
||||
## [1989/westley](1989/westley/westley.c) ([README.md](1989/westley/README.md))
|
||||
### STATUS: main() function args not allowed - please help us fix
|
||||
|
||||
This entry is a big problem for clang due to the way it is designed; only the
|
||||
first (the same as the original) and second (`ver1.c`) will compile with clang.
|
||||
However all will compile with clang. Cody has made good progress and he intends
|
||||
to work on it more, hopefully solving it, but at this time only gcc will fully
|
||||
work. This is better than it was when there had to be alt code because some
|
||||
versions did not compile with any compiler, not just clang.
|
||||
|
||||
The `ver2` and `ver3` cannot be compiled with clang due to wrong arg types to
|
||||
`main()` and in some versions of clang, too many args to `main()`.
|
||||
|
||||
With gcc, however, all the versions work.
|
||||
|
||||
### STATUS: known bug - please help us fix
|
||||
### STATUS: INABIAF - please **DO NOT** fix
|
||||
|
||||
With version 2 it sometimes segfaults even with the same input where other times
|
||||
it does not. We don't believe this is because of the fix that lets some versions
|
||||
@@ -536,7 +522,7 @@ be compiled with clang. An example invocation is:
|
||||
./ver2 < westley.c
|
||||
```
|
||||
|
||||
Can you find the problem?
|
||||
We consider it not worth fixing at least at this time.
|
||||
|
||||
### A useful note on changing/fixing this program
|
||||
|
||||
|
||||
+60
-13
@@ -18,10 +18,12 @@ CHALLENGING bug fixes** like
|
||||
[2004/burley](/thanks-for-fixes.md#2004burley-readmemd), making entries like
|
||||
[1985/sicherman](/thanks-for-fixes.md#1985sicherman-readmemd) and
|
||||
[1986/wall](/thanks-for-fixes.md#1986wall-readmemd) not need `-traditional-cpp`
|
||||
(all **EXTREMELY CHALLENGING**), fixing entries to work with clang (some
|
||||
being **EXTREMELY CHALLENGING** like
|
||||
[1991/dds](/thanks-for-fixes.md#1991dds-readmemd)), porting entries to macOS
|
||||
(some being **EXTREMELY CHALLENGING** like
|
||||
(all **EXTREMELY CHALLENGING**), fixing entries to work with clang (some being
|
||||
**EXTREMELY CHALLENGING** like
|
||||
[1991/dds](/thanks-for-fixes.md#1991dds-readmemd)) or as much as possible (like
|
||||
[1989/westley](/thanks-for-fixes.md#1989westley-readmemd) which is **INCREDIBLY
|
||||
HARD, _MUCH, MUCH MORE SO_ than any other fix!**), porting entries to macOS (some being
|
||||
**EXTREMELY CHALLENGING** like
|
||||
[1998/schweikh1](/thanks-for-fixes.md#1998schweikh1-readmemd)), fixing code like
|
||||
[2001/herrmann2](/thanks-for-fixes.md#2001herrmann2-readmemd) to work in both
|
||||
32-bit/64-bit which *can be* **EXTREMELY CHALLENGING**, providing alternate code
|
||||
@@ -769,17 +771,62 @@ not his only reason :-) )
|
||||
|
||||
## [1989/westley](1989/westley/westley.c) ([README.md](1989/westley/README.md]))
|
||||
|
||||
Cody got some of the versions (the original and `ver0` and `ver1`) to work with some
|
||||
versions of `clang`; all the versions work with gcc.
|
||||
Cody fixed this for clang, except that two versions generated by the program
|
||||
cannot be compiled by clang due to inherent defects in the compiler and how the
|
||||
entry works. This is an **incredibly hard** one to fix for clang whilst still
|
||||
being compilable with gcc (and gcc can compile every generated version with the
|
||||
fix) and even if one fixes it to compile with clang it does not mean that any
|
||||
other version will compile! It is, however, possible to get clang to work with
|
||||
two versions generated, `ver0` and `ver1`, though `ver0` is actually just the
|
||||
main entry (but still generated by the program itself).
|
||||
|
||||
Unfortunately there are some defects in `clang` that break this entry either in
|
||||
full or in part. In particular the first arg to `main()` has to be an int and
|
||||
the rest have to be a `char **` but some versions do not allow four args. So to
|
||||
get past this another function was added, `pain()`, which takes the place of
|
||||
`main()` and which `main()` calls.
|
||||
Unfortunately due to the way this entry works if it is even possible to get all
|
||||
versions to compile with clang it will take heavy modifications to get all
|
||||
versions to compile with clang. Cody almost got it and knows how it functions
|
||||
but even getting it just about there caused compilation errors in gcc so it
|
||||
might just not be possible.
|
||||
|
||||
Originally alt code, Cody got it to all versions to work with gcc so it is no
|
||||
longer an alt version.
|
||||
The way it was fixed might be hard to see and describe but this is an attempt.
|
||||
Because `main()`'s args were all `int`s, `main()` had to call a new function
|
||||
which is allowed to have args as `int` (instead of `main()`'s args being int and
|
||||
the rest being `char **`) but this is not as straight forward as it is for other
|
||||
entries (if you look at the code you might see what is meant; the function called
|
||||
is `pain()`).
|
||||
|
||||
The args of `main()` had to be set to the right type but only three args, **not
|
||||
four**, even though the original program has four args. This is because not all
|
||||
versions of clang support four args and that is one of the issues with version 2
|
||||
and 3 as it generates `main()` to have four args and the wrong type, all `int`s.
|
||||
|
||||
In the call to the new function, `pain()`, from `main()`, one of the `char **`s
|
||||
is used twice, once as `argc` with bitwise AND with 2, naturally first being
|
||||
cast to an `int` (`(int)ABBA&2`), and once as a `char **`, the fourth arg to
|
||||
`pain()` (yes even though `pain()` takes all `int`s).
|
||||
|
||||
The argc,, meanwhile, `tang`, is used once and the second arg, `char **gnat` is
|
||||
used once (observe how `tang` is `gnat` spelt backwards as this is one of the
|
||||
things that makes this a masterpiece and very hard if not impossible to fix
|
||||
completely). Fortunately it is not actually necessary to use all four args (of
|
||||
`main()`) in the call which might or might not be surprising, especially as it
|
||||
uses one of the args, a `char **`, instead of an `int` (through casts), twice
|
||||
rather than just passing in for the fourth arg (the fourth arg passed in is the
|
||||
third arg to `main()`).
|
||||
|
||||
This program heavily uses recursion and depending on the number of args it will
|
||||
print out output normally, ROT13 it, show it backwards or both. Along with the
|
||||
ROT13 and reversed output of the code, it is the **comments that create the
|
||||
names and the rest of the code!**: sometimes it is the word backwards, other
|
||||
times it is the ROT13 of it and other times it is both, both for comments and
|
||||
otherwise. Trying to change comments can be very difficult though it was done
|
||||
when clang could almost compile every version if not actually compile all
|
||||
versions. Unfortunately when this was done it caused other systems to have
|
||||
additional compilation errors so it seems highly unlikely that version 2 and 3
|
||||
can work for clang (versions 0 and 1 can).
|
||||
|
||||
Despite the risks of changing names this was done and indeed by necessity.
|
||||
Comments might have been changed but it is no longer known if that happened only
|
||||
in the working on version 2 and 3 or if in the fix for clang as well as version
|
||||
0 and 1.
|
||||
|
||||
To make use of this several scripts were added by Cody.
|
||||
|
||||
|
||||
Reference in new issue
Block a user