From 38fed3b3416f09f5bf9fb371fe3398d96cb6ebf9 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Tue, 17 Oct 2023 09:52:58 -0700
Subject: [PATCH 01/10] Typo/format check 1986/applin/README.md
---
1986/applin/README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/1986/applin/README.md b/1986/applin/README.md
index 7bd0f6ff4..5c1f3976c 100644
--- a/1986/applin/README.md
+++ b/1986/applin/README.md
@@ -1,7 +1,7 @@
# Most adaptable program
-Jack Applin
-US
+Jack Applin
+US
## To build:
From 5e3801e7cff67949742ab985a8666e0e25058d8b Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Tue, 17 Oct 2023 09:53:14 -0700
Subject: [PATCH 02/10] Format/typo check 1986/august/README.md
---
1986/august/README.md | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/1986/august/README.md b/1986/august/README.md
index 748a80ca5..6255f3c0a 100644
--- a/1986/august/README.md
+++ b/1986/august/README.md
@@ -1,6 +1,6 @@
# Best complex task done in a complex way
-Lennart Augustsson
+Lennart Augustsson
## To build:
@@ -15,13 +15,12 @@ make all
./august
```
-
NOTE: this entry is very likely to core dump after its output.
## Judges' remarks:
This program computes a specific mathematical value. Simply compile
-and give it an infinite amount of stack space and cpu time. Otherwise
+and give it an infinite amount of stack space and CPU time. Otherwise
just be satisfied with the approximation displayed just before the core
dump.
From a70db3f93abde153ad37c5cf781c27d3ce8d4a46 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Tue, 17 Oct 2023 09:53:28 -0700
Subject: [PATCH 03/10] Format/typo check 1986/bright/README.md
---
1986/bright/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/1986/bright/README.md b/1986/bright/README.md
index b85aab2da..aed5db631 100644
--- a/1986/bright/README.md
+++ b/1986/bright/README.md
@@ -1,6 +1,6 @@
# Most useful obfuscation
-Walter Bright
+Walter Bright
## To build:
From aa131914ed1841f9142df7bd028a21ab84055f5d Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Tue, 17 Oct 2023 09:53:44 -0700
Subject: [PATCH 04/10] Format/typo check 1986/hague/README.md
---
1986/hague/README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/1986/hague/README.md b/1986/hague/README.md
index 333fe3139..97adc092f 100644
--- a/1986/hague/README.md
+++ b/1986/hague/README.md
@@ -1,6 +1,6 @@
# Worst abuse of the C preprocessor
-Jim Hague
+Jim Hague
UK
## To build:
@@ -62,7 +62,7 @@ others.
This program was selected for the 1987 t-shirt collection.
-Think Morse code when you ponder this program. Note how use of
+Think Morse code when you ponder this program. Note how the use of
similar variables can be obfuscating! The author noted that this
program implements the international Morse standard. Now for extra
credit, what Morse message does the program spell out?
From 846339262ff81bb32befc124cbb68a4cb330727f Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Tue, 17 Oct 2023 09:54:04 -0700
Subject: [PATCH 05/10] Format/typo check 1986/holloway/README.md
---
1986/holloway/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/1986/holloway/README.md b/1986/holloway/README.md
index 4be41a680..7adfd730e 100644
--- a/1986/holloway/README.md
+++ b/1986/holloway/README.md
@@ -1,6 +1,6 @@
# Best simple task performed in a complex way
-Bruce Holloway
+Bruce Holloway
US
## To build:
From 9cb85e0f18bced7f212242e5cd2e058e9fec8207 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Tue, 17 Oct 2023 09:54:25 -0700
Subject: [PATCH 06/10] Update 1986/marshall/README.md
Reworded the explanation of the funny opposite/conflicting problems with
gcc and clang depending on if the optimiser is disabled or enabled, that
I fixed and added alt code to demonstrate it.
---
1986/marshall/README.md | 50 ++++++++++++++++++++++-------------------
thanks-for-fixes.md | 22 +++++++++---------
2 files changed, 37 insertions(+), 35 deletions(-)
diff --git a/1986/marshall/README.md b/1986/marshall/README.md
index 2cc2eb860..5974f30b3 100644
--- a/1986/marshall/README.md
+++ b/1986/marshall/README.md
@@ -8,12 +8,13 @@ Eric Marshall
make all
```
-There is an alternate version. See the Alternate code section for the commentary
-on why this is: there was a funny problem in modern systems where depending on
-the compiler and flags it would work with one compiler with the optimiser but it
-would not work with the other; and if the optimiser state is changed the
-previous problematic compiler might work but the other one would not! We
-describe this in more detail below and we encourage you to read it.
+There is an alternate version. See the [Alternate code](#alternate-code) section
+for the commentary on why this is: there was a funny problem in modern systems
+where depending on the compiler and the optimiser it would work with one
+compiler with the optimiser but it would not work with the other; and if the
+optimiser state is changed the previous problematic compiler might work but the
+other one would not. We describe this in more detail below and we encourage you
+to read it for entertainment if nothing else.
## Try:
@@ -29,36 +30,37 @@ options briefly noted above we provide the code that demonstrates the problem so
you can see if your compiler has the problem as described below.
In some versions of gcc and clang (this was first discovered in fedora linux 38)
-depending on whether or not the optimiser was enabled would cause one compiler
-to generate code that segfaults but not another - but when changing the state
-of the optimiser the opposite would happen: the compiler that did not cause a
-segfault suddenly did and the one that did now worked! Another problem was an
-infinite loop also depending on the optimiser.
+if the compiler was enabled one compiler would generate code that segfaulted but
+the other one would not. However, when then disabling the optimiser the compiler
+that had no problem suddenly did and the one that did suddenly did not.
+
+Another problem was that depending on the optimiser an infinite loop would be
+entered.
The alternate code has the original fix for clang which works with some
compilers depending on the optimiser. When we refer to the code below we refer
to the alternate code.
-### The conflicting compiler problems:
+#### The conflicting compiler problems:
Below we describe the conflicting options that resulted in the need to modify
the original code.
-#### Linux
+##### Linux
With the optimiser disabled GCC compiled the code to enter an infinite loop.
Enabling the optimiser and it worked fine. But if the optimiser is enabled clang
generates code that first prints the text twice (it should print it once) and
then immediately dumps core!
-But then what happens if we remove the infinite loop?
+But then there's that infinite loop. What happens if we remove it?
-Once the loop is fixed if we compile with clang and the optimiser is disabled
+Once the loop is removed if we compile with clang and the optimiser is disabled
all is okay. If however we compile with gcc and the optimiser is disabled the
-string is printed once and the program then dumps core! Why is this? It is
+string is printed once and then the program dumps core! Why is this? It is
because of the call to `_exit()` (see below). Clang works fine with the loop
removed and the optimiser disabled. If however we enable the optimiser clang
-generates code that prints the string twice and dumps core just like before!
+will generate code that prints the string twice and dumps core just like before!
What about the call to `_exit()`?
The call was:
@@ -71,10 +73,10 @@ _exit(argv[(int)*argc-2/cc[1*(int)*argc]|-1<<4]);
Changing it to not refer to these variables and just exit 1 and the problems
disappear!
-#### macOS
+##### macOS
But as noted just because it works one way in linux does not mean it works the
-same way in macOS!
+same way in macOS.
If the infinite loop is not removed/commented out and the optimiser is enabled
it works fine but if it's disabled it prints out the string and then enters an
@@ -89,7 +91,8 @@ $ ./marshall
Segmentation fault: 11
```
-Observe how it doesn't print it twice.
+Observe how it doesn't print it twice. But of course it segfaults so it's not
+right either.
If the optimiser is enabled, however, we will see that it works fine before the
change to `_exit()`.
@@ -97,9 +100,10 @@ change to `_exit()`.
#### To use:
-Due to the different conflicting problems we instead offer the problematic code
-as an alternate version whereas [marshall.c](marshall.c) has both the infinite
-loop and the complicated arg to `_exit()` commented out, replaced by just `1`.
+Due to the different conflicting problems with gcc and clang, we instead offer
+the problematic code as an alternate version whereas [marshall.c](marshall.c)
+has both the infinite loop and the complicated arg to `_exit()` commented out,
+changing the value passed into `_exit()` to `1`.
To try out the alternate version:
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index 53245653f..d18f6ea8f 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -229,24 +229,22 @@ and gcc.
## [1986/marshall](1986/marshall/marshall.c) ([README.md](1986/marshall/README.md]))
-Cody got this to compile and work with clang and gcc. The optimiser being
+Cody got this to compile and work with clang and gcc. He noted that he tried to
+keep the ASCII art as close to the original as possible. The line lengths are
+the same but some spaces had to be changed to non-spaces.
+
+This fix was very interesting and quite amusing, showing up problems with
+compilers. This is a brief summary but much more is explained in the README.md,
+giving which compilers had which problems in which systems: the optimiser being
enabled in one compiler let it work but broke it in the other; and disabling it
would let it work in the one that didn't work but suddenly the one that worked
-would be broken. See below and the README.md file for more details.
+would be broken.
This problem was only after getting clang to compile, of course. It did not
compile it because it is more strict about the second and third args to `main()`
-and the third arg was an `int`. Cody notes that he tried to keep the ASCII art
-as close to the original as possible. The line lengths are the same but some
-spaces had to be changed to non-spaces.
+and the third arg was an `int`.
-As noted above, a very funny problem occurred depending on the compiler and
-whether or not the optimiser was enabled that had to be fixed: one compiler
-would work fine but another might enter an infinite loop or segfault but then
-once the optimiser state was changed the compiler that worked no longer worked
-(in the same was as the other one not working) and the one that didn't work did!
-
-We encourage you to see the README.md file to see how odd this problem was and
+We encourage you to read the README.md file to see how odd this problem was and
what Cody did to fix it!
From 40f27797b124fbf5940fc8ce8b30ba0f42468924 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Tue, 17 Oct 2023 10:00:20 -0700
Subject: [PATCH 07/10] Format/typo check 1986/pawka/README.md
---
1986/pawka/README.md | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/1986/pawka/README.md b/1986/pawka/README.md
index 247868801..6e9e6c6a2 100644
--- a/1986/pawka/README.md
+++ b/1986/pawka/README.md
@@ -1,9 +1,7 @@
# Most illegible code
-Michael H. Pawka
-Naval Ocean Systems Center
-San Diego, Ca
-92152
+Michael H. Pawka
+US
## To build:
From fbb4e51310f560a292e524687b4c61a55d0bf3c9 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Tue, 17 Oct 2023 10:13:29 -0700
Subject: [PATCH 08/10] Format/typo check 1986/stein/README.md
---
1986/stein/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/1986/stein/README.md b/1986/stein/README.md
index 9112b5ff3..1bdd6f3cb 100644
--- a/1986/stein/README.md
+++ b/1986/stein/README.md
@@ -1,6 +1,6 @@
# Best one liner
-Jan Stein
+Jan Stein
## To build:
From b094d5cd48d80b1bf3ce52c931a04a8d3b7b4c9d Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Tue, 17 Oct 2023 10:23:31 -0700
Subject: [PATCH 09/10] Format/typo check 1986/wall/README.md
---
1986/wall/README.md | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/1986/wall/README.md b/1986/wall/README.md
index fc24c5e99..d6b18ed0e 100644
--- a/1986/wall/README.md
+++ b/1986/wall/README.md
@@ -1,6 +1,6 @@
# Grand prize in most well-rounded in confusion
-Larry Wall
+Larry Wall
US
## To build:
@@ -38,11 +38,12 @@ The original version did not have a ';' character in the first line.
This caused a number of System V C pre-preprocessors to gripe about a
syntax error.
-This program is a masterpiece of obfuscation and humor. Larry Wall
-(the hacker who gave us `rn` and `patch`) asks you to compile and consider
-the warning message generated by the C compiler. Then execute the
-program and type characters into its standard input. You will see why
-the compiler documents the program.
+This program is a masterpiece of obfuscation and humor. Larry Wall (the hacker
+who gave us [rn](https://en.wikipedia.org/wiki/Rn_(newsreader)) and
+[patch](https://en.wikipedia.org/wiki/Patch_(Unix))) asks you to compile and
+consider the warning message generated by the C compiler. Then execute the
+program and type characters into its standard input. You will see why the
+compiler documents the program.
## Author's remarks:
From 70cee412ac92e915b13a098c70b5f89e6b9fd9b3 Mon Sep 17 00:00:00 2001
From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com>
Date: Tue, 17 Oct 2023 10:24:31 -0700
Subject: [PATCH 10/10] Fix 1986/pawka/Makefile
The flag -Wno-strict-prototypes was put in the CDEFINE variable,
suggesting that it might need a -D flag when it of course does not. This
is not strictly an error but it's also not strictly correct so I
strictly decided to make it correct.
At the same time I added to CSILENCE -Wno-implicit-int, a warning that
has shown up in macOS recently, very possibly with macOS Sonoma, and so
might have to be added to many Makefiles.
---
1986/pawka/Makefile | 5 +++--
thanks-for-fixes.md | 6 ++++++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/1986/pawka/Makefile b/1986/pawka/Makefile
index d182f0e99..0b3fa1adb 100644
--- a/1986/pawka/Makefile
+++ b/1986/pawka/Makefile
@@ -38,7 +38,8 @@ include ../../var.mk
# Common C compiler warnings to silence
#
-CSILENCE= -Wno-non-literal-null-conversion -Wno-unused-value
+CSILENCE= -Wno-non-literal-null-conversion -Wno-unused-value -Wno-strict-prototypes \
+ -Wno-implicit-int
# Common C compiler warning flags
#
@@ -57,7 +58,7 @@ ARCH=
# Defines that are needed to compile
#
-CDEFINE= -Wno-strict-prototypes
+CDEFINE=
# Include files that are needed to compile
#
diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md
index d18f6ea8f..1743098b2 100644
--- a/thanks-for-fixes.md
+++ b/thanks-for-fixes.md
@@ -247,6 +247,12 @@ and the third arg was an `int`.
We encourage you to read the README.md file to see how odd this problem was and
what Cody did to fix it!
+## [1986/pawka](1986/pawka/pawka.c) ([README.md](1986/pawka/README.md))
+
+Cody noticed and fixed a funny mistake in the Makefile where a
+`-Wno-strict-prototypes` was in the wrong location, suggesting that there is a
+`-D` needed to compile the entry.
+
## [1986/wall](1986/wall/wall.c) ([README.md](1986/wall/README.md]))