From a2e77e1ca6ddb33a183fc5d2dc25d9fcd8c820b2 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 19 Dec 2023 10:04:10 -0800 Subject: [PATCH] Force -O0 in 2004/kopczynski --- 2004/kopczynski/Makefile | 7 +++++-- 2004/kopczynski/README.md | 22 +++++++--------------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/2004/kopczynski/Makefile b/2004/kopczynski/Makefile index 589fed63c..a4fdf241e 100644 --- a/2004/kopczynski/Makefile +++ b/2004/kopczynski/Makefile @@ -66,7 +66,8 @@ CINCLUDE= # Optimization # -OPT= +# We DISABLE the optimiser because having it enabled BREAKS the program. +OPT= -O0 # Default flags for ANSI C compilation # @@ -129,8 +130,10 @@ all: data ${TARGET} clean clobber install love haste waste maker easter_egg \ sandwich supernova deep_magic magic charon pluto +# NOTE: We FORCE the use of -O0 even if someone overrides it because this entry +# will not work with it enabled. ${PROG}: ${PROG}.c - ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} + ${CC} ${CFLAGS} -O0 $< -o $@ ${LDFLAGS} # alternative executable # diff --git a/2004/kopczynski/README.md b/2004/kopczynski/README.md index 2ffcef98c..8d585eae1 100644 --- a/2004/kopczynski/README.md +++ b/2004/kopczynski/README.md @@ -4,6 +4,9 @@ make ``` +NOTE: We FORCE the use of -O0 even if someone overrides it because this entry +will not work with it enabled. + ## To use: @@ -15,22 +18,9 @@ make ### Try: ```sh -./kopczynski < kopczynski-8a -./kopczynski < kopczynski-8b -./kopczynski < kopczynski-8c -./kopczynski < kopczynski-9 -./kopczynski < kopczynski-10 -./kopczynski < kopczynski-11 +./try ``` -Also try: - -```sh -./kopczynski < kopczynski-a -``` - -What happens? - What happens if you feed the program source to the program? Can you figure out why? @@ -38,7 +28,9 @@ why? ## Alternate code: The judges modified the program to print its result. The original -program returned the result as an exit code: +program returned the result as an exit code which is what the alternate version +does. + ### Alternate build: